Skip to content

Use Case: Patching XML

do- edited this page Dec 27, 2021 · 6 revisions

Input

Consider the following XML given as a string named xmlSource:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header/>
  <SOAP-ENV:Body>
    <GetResponseResponse xmlns="urn://some-schema" xmlns:ns0="urn://another-schema">
      <ResponseMessage>
        <Response>
          <OriginalMessageId>00000000-0000-0000-0000-000000000000</OriginalMessageId> <!-- to be substituted -->
          <SenderProvidedResponseData>
<!-- and so on -->

Problem

The goal is to obtain the XML text representing the same document with OriginalMessageId's content replaced with a given id.

Clone this wiki locally