Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You haven't specified a technology, so assuming that you haven't set up the equivalent of a .NET NameSpace manager or similar, you can use namespace agnostic Xpath as follows:</p> <pre><code>/*[local-name()='Envelope']/*[local-name()='Header'] /*[local-name()='ReplyTo']/*[local-name()='ReferenceParameters'] /*[local-name()='ServiceGroupId']/text() </code></pre> <p><strong>Edit</strong> Updated for Java</p> <p>Without namespace aliases</p> <pre><code>XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expression = xpath.compile("/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='ReplyTo']/*[local-name()='ReferenceParameters']/*[local-name()='ServiceGroupId']/text()"); System.out.println(expression.evaluate(myXml)); </code></pre> <p>With <a href="https://stackoverflow.com/questions/914013/namespacecontext-and-using-namespaces-with-xpath">NamespaceContext</a></p> <pre><code>NamespaceContext context = new NamespaceContextMap( "soapenv", "http://schemas.xmlsoap.org/soap/envelope/", "wsa", "http://www.w3.org/2005/08/addressing", "axis2", "http://ws.apache.org/namespaces/axis2"); XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); xpath.setNamespaceContext(context); XPathExpression expression = xpath.compile("/soapenv:Envelope/soapenv:Header/wsa:ReplyTo/wsa:ReferenceParameters/axis2:Serv‌​iceGroupId/text()"); System.out.println(expression.evaluate(myXml)); </code></pre> <p><code>local-name()</code> gives the tag name of the element agnostic of its namespace. Also, the <code>encoding</code> in your above xml document doesn't look right.</p> <p><strong>Edit</strong></p> <p>Assuming that <code>urn:uuid:</code> is a constant, the following XPath will strip off the first 9 characters of the result (use with either of the above XPath). If <code>urn:uuid</code> isn't constant, then you'll need to tokenize / split etc, <a href="https://stackoverflow.com/questions/136500/does-xslt-have-a-split-function">which is beyond my skills</a>.</p> <pre><code>substring(string(/*[local-name()='Envelope']/*[local-name()='Header'] /*[local-name()='ReplyTo']/*[local-name()='ReferenceParameters'] /*[local-name()='ServiceGroupId']/text()), 10) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload