Forum Discussion

thestraw's avatar
thestraw
Occasional Contributor
8 years ago

copy xml node from one XmlHolder to another

 

How do I work with setNodeValue()?

 

I've tried the following without success(no replacement takes place):

 

request.setNodeValue("/", "none" )

And I need to end up with something like this, where I copy a signature tag from one holder to the other:

 


request.setNodeValue("signature xpath", soapExpandedMessageXMLHolder.getNodeValue("signature xpath"))

 

6 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Thestraw,

     

    As far as I remember, the setNodeValue method has the following parameters:

    1. the XPath expression to the target node
    2. the new value
    setNodeValue (<Your_XPath>,<Your_Value>)
  • nmrao's avatar
    nmrao
    Champion Level 3
    May be you want to show the input and desired ouput xml which might help?
  • thestraw's avatar
    thestraw
    Occasional Contributor

    I want to copy a tag called "signature" from one XmlHolder object to another.

    Since I couldn't make it to work, I've tried something basic like:

     

    request.setNodeValue("/", "none" )

     

    It didn't update the root node with anything. 

    • nmrao's avatar
      nmrao
      Champion Level 3
      Sorry, that did not help. May be some more context is needed to understand.
      • thestraw's avatar
        thestraw
        Occasional Contributor
        <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
        <note>
        <Signature>.....</Signature>
        </note>

         

        I want to copy the 

        <Signature>.....</Signature>

         and from one xmlHolder to another.