Question

I have a XML in following format

<Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <TransactionAcknowledgement xmlns="">
    <TransactionId>HELLO </TransactionId>
    <UserId>MC</UserId>
    <SendingPartyType>SE</SendingPartyType>
  </TransactionAcknowledgement>
</Body>

I want to user XQuery or XPath expression for it.

Now I want to remove only

xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"

namespace from xml.

Is there any way to achieve it.

Thanks

Était-ce utile?

La solution

Try to use functx:change-element-ns-deep:

let $xml := <Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <TransactionAcknowledgement xmlns="">
    <TransactionId>HELLO </TransactionId>
    <UserId>MC</UserId>
    <SendingPartyType>SE</SendingPartyType>
  </TransactionAcknowledgement>
</Body>

return functx:change-element-ns-deep($xml, "http://schemas.xmlsoap.org/soap/envelope/", "")

But as said Dimitre Novatchev this function doesn't change namespace of the source xml, it creates a new XML.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top