Skip to main content

I have a soap error response and need to parse the XML - Using a QueryXML step and having issues where a colon is in the node name, which is often is in SharePoint responses.

NOT processing

not processing with semicolon

Remove the soap: bit and... voila it works

working

What am I doing wrong here?

Tried defaultNS and other things but no dice...

at first, that's not semicolon but rathet colon, which is common in XML as you noticed

at second it not problem of colon but problem of how you setup your testcase.

you will definitely not get back XML like you test with but rather something like this

<soap:Fault xmlns:soap="http://www.something.com">
  <test>123</test>
</soap:Fault>

so 'soap' which denotes namespace should have it's definition.

with that input XML following XPath should work

/soap:Fault/test


Thanks - nice - After much messing around I got it working without a fake namespace...

/soap:Fault/defaultNS:test


Hi ‌,

can you please select one of Marians answers as corect so others will see that there has been a solution found.

Thanks

Philipp


Hi Sean Cochrane‌,

I'm very sorry, but answer you marked as correct doesn't work with your original input!

so, if you think my reply is not correct or doesn't work with your real input, please, update you post (correct answer) with an input which it works on.

this way it might be misleading for those who will come across this later.

thanks.


The requirement was not to have to add fake namespaces which bloat the code - finding the defaultNS: shortcut is what I originally wanted hence why I marked my answer as correct.


whatever your requirement was, definitely, the question and designated answer do not fit together.

they are not 'fake namespaces', without namespace definition your input string is not valid XML document, hence no XPath can work on it.

(check XML validity  eg. here http://www.xmlvalidation.com )

read my post once again, I haven't said you should add or remove anything.

I just tried to explain, from info you provided, what's the problem and a possible way how could it be resolved.


Fine...  but both answers are correct


Reply