Search code examples
xmlwebmethods

How to use appendToDocumentList in webMethods?


This is the main XML structure:

<A> 
    <B> 
        <C>letter C</C> 
    </B>
</A> 

I'd like to insert certain block xml after element B.


Solution

  • pub.list:appendToDocumentList operates over IData (document). To use it you need to create this document.

    Is your XML structure static?
    If yes create a document on IS that resembles your XML structure, then (assuming you have your XML in a string):

    1. convert string to IData (document) using:

      • pub.xml:xmlStringToXMLNode
      • pub.xml:xmlNodeToDocument
    2. Use pub.list:appendToDocumentList to add new element to e.g. <B> list

    3. Convert document back to string using pub.xml:documentToXMLString

    If no you still need to create a document in the pipeline:
    enter image description here

    and then use pub.list:appendToDocumentList: enter image description here

    Ultimetly if required, convert document to string using pub.xml:documentToXMLString