1

How to get the element of CCC? Xpath sees only the s:Envelope and s:Body.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <BBB xmlns="https://services">
            <CCC>test</CCC>
        </BBB>
    </s:Body>
</s:Envelope>

2 Answers 2

1

Assuming the namespace context for your XPath expression contains the namespace bindings

s = http://schemas.xmlsoap.org/soap/envelope/
t = https://services

then the XPath expression

/s:Envelope/s:Body/t:BBB/t:CCC

will find the CCC element.

The way in which you establish namespace bindings depends on the XPath API you are using.

Sign up to request clarification or add additional context in comments.

3 Comments

The namespace context for my XPath expression not contains the namespace binding t = https://services in this issue
I can not add it, the answer is a third-party service
@GlebBelyaev Michael Kay is saying to add it to your XPath processor, not to the source XML.
1

try this:

/s:Envelope/s:Body/*:BBB/*:CCC

1 Comment

Here's another way to //*[local-name()='CCC']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.