Sidebar

how to process xml string in QIE

0 votes
497 views
asked Dec 18, 2013 by (140 points)
edited Dec 18, 2013 by
Hi,

We are sending the output as xml string from mapping node to the calling client. But while sending the output I also need to add some more tags like status (ok/fail) or error code etc and then will send back it to client. This would help at client end in case error occurs and then accordingly the process can be set up.

So can anybody please let me know as how to acheive this in QIE, are there any examples available for this.

Regards

Parag

1 Answer

0 votes

Our "QIE Reference Manual" from the help menu drop down in QIE has some xpath expressions that will help with the path that you will want to use on page 103.

If your message is not already in XML then you can convert the String to XML with:

message = qie.parseXMLString(message.getNode('/'));

You can add to XML content in several ways. 

Using this XML as an example:
<bookstore>
   <book id="abc">
      <title lang="english">Harry Potter</title>
      <price>29.99</price>
   </book>
</bookstore>

To add an attribute:

message.setNode("/bookstore/book/price/@discount", 'Yes');

Or to add an element:

message.setNode("/bookstore/book/price", '<Status>Ok</Status>');

Also here is a link to an example channel that you can import:

https://www.qvera.com/files/qie_Sample_Xpath_Add_Attribute.zip

 

answered Dec 18, 2013 by michael-h-5027 (14,350 points)
...