Forum Discussion

pf's avatar
pf
Occasional Contributor
16 years ago

Insert node with xQuery in Property Transfer

Hello, I'm new to xQuery/xPath and I'll manipulate a request.

I would like to insert informations from a datasource and the response of the step before - but that's not the problem, the Problem is now to insert a node without overwriting the existing things.

example source:


 
 


result should look like the following


  c
  b
  a
    123
 



Is it possible to insert with a property transfer step and xQuery/xPath?

source in property transfer (xQuery):


{
for $z in //testText
return $z/text()
}


destination in property transfer (XPath):

//root

How do I have to define the xPath in the destination that node3 is added and not is overwritten?

result now is:


  123


thank you for help... 

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    hmm.. I can come up with the following "solution";

    1) Set the target of your property-transfer to a temporary property in your TestCase
    2) "use" that property in your request via property-expansion.. ie if you call the property "tempXml" your request-xml would be


     
     
      ${#TestCase#tempXml}


    Obviously this a  work-around that will only work in certain situations, a better fix would be for us to add a "append" option in the property-transfer that would append source nodes to target node.. or?

    regards!

    /Ole
    eviware.com
  • pf's avatar
    pf
    Occasional Contributor
    Hi

    yes, I've done it now with a temporary property.

    and yes, I think such an "append" in the property-transfer would be a great idea! then we could insert/append nodes very easy!

    thanks!

    regards!
    iwan