0

Here is the XML:

<VDWSDirectoriesResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Success>true</Success>
<TotalResult>6</TotalResult>
<PageResult>6</PageResult>
<Summary/>
<DirectoriesResult>...</DirectoriesResult>
</VDWSDirectoriesResult>

I would like to get the Success node, I tried /VDWSDirectoriesResult/Success or Success, but I still can't get the value of Success node...What Did I do wrong? Thanks.

1 Answer 1

4

Your root node declares a default namespace:

xmlns="http://tempuri.org/"

This means, your <Success> node is actually in that namespace, and not in the anonymous namespace assumed by XPath if you just write Success in your XPath expression.

Depending on the XPath library you are using, there will be some way of mapping a namespace prefix to the namespace URI http://tempuri.org/, which you can then use in your XPath expression.

For example, let's assume that you map the namespace prefix tmp to that URI, your XPath should read:

/tmp:VDWSDirectoriesResult/tmp:Success
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.