Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

TXmlMap include document field in output xml

Hello everybody
I'm developing a POST REST service which have to get the input xml, transform it, and call a soap service.
in_xml:
<items>
   <item>
       <id>
       <des>
       <list of characteristic>
             <char>
                  <cod>
                   .....
             </char>
       </list of characteristic>
       <list of prices>
             <price>
                   <class>
                   <value>
             </price>
             ......
       </list of prices>
   </item>
   .....
</items>              


in order to remap xml_in I thought to use textractXMLFileds looping over  list of characteristic/Char  tag.
I've created a ListOfPrices field(type document ) where to collect the entire  </list of prices> node (using GetNode flag)


my queston is: how to put  ListOfPrices  field inside the tXmlMap configuration?
if not possible, any other ideas?

thank you
Labels (3)
2 Replies
Anonymous
Not applicable
Author

If I understand you correctly, you want to go from this....

<items>
   <item>
       <id>
       <des>
       <list of characteristic>
             <char>
                  <cod>
                   .....
             </char>
       </list of characteristic>
   </item>
   .....
</items>              

.....to this......
<items>
   <item>
       <id>
       <des>
       <list of characteristic>
             <char>
                  <cod>
                   .....
             </char>
       </list of characteristic>
       <list of prices>
             <price>
                   <class>
                   <value>
             </price>
             ......
       </list of prices>
   </item>
   .....
</items>             

By adding the list of prices section after the list of characteristic. Is that right?

If so, you can do this with a couple of extra steps to what you have already. If you already have this....

<items>
   <item>
       <id>
       <des>
       <list of characteristic>
             <char>
                  <cod>
                   .....
             </char>
       </list of characteristic>
   </item>
   .....
</items>              
[font=Verdana, Helvetica, Arial, sans-serif] ....then use a tConvertType on your Document to convert it to a string. Next do the same for this section that you have created.....[/font]
       <list of prices>
             <price>
                   <class>
                   <value>
             </price>
             ......
       </list of prices>
Once you have these as strings, it is a simple find and replace using Java String manipulation. Look for " </list of characteristic>" in you main XML String and replace it with .....

"</list of characteristic>
       <list of prices>
             <price>
                   <class>
                   <value>
             </price>
             ......
       </list of prices>"



Once you've done that, just convert the resulting String to a Document using the tConvertType. 

You *may* run into an issue with having to remove the <XML> tag from the XML document you create with "List of prices". But that is pretty simple to do with a regex.

This sounds complicated but it is actually pretty simple.
Anonymous
Not applicable
Author

Sounds good!!!
should work  0683p000009MAB6.png
thanks a lot...