How to convert XmlElement/XmlDocument to Text? I am working on Outsystems(Java)

How to convert XmlElement/XmlDocument to Text? I am working on Outsystems(Java)

  
How to convert XmlElement/XmlDocument to Text? I am working on Outsystems(Java)
Solution
Good morning,
Have you tried this?


Solution
Hey Very good morning,

Thanks for your response. Your response is helpful and worked partially.
As a first step I loaded the xml and used XmlDocument_Save() to see whether the xml document is created or not. This step is successful and I am able to see the complete document xml.

The second step is failing, may be I am dong some thing wrong. As part of second step, I am trying to retrieve the part of xml using xpath. After I used XmlDocument_SelectNodes() by providing xpath, calling XmlDocument_Save() is giving me the empty string.

I am not sure whether the call to XmlDocument_SelectNodes() has failed or XmlDocument_Save() failed converting document to xml. Appreciate your response.
I noticed that, XmlDocument_Save() is working for XmlDocument only. Whereas, XmlDocument_SelectNodes()
is returing XmlNodes, that is the reason why I am getting empty string.
Still my problem remains unsolved. Is there any better solution than this or any alternate solution for my problem ?
Hi Raj,

Once  you have XmlNodes, you can use the other actions in the extension, to retrieve selected parts of those XmlNodes as text, such as XML_GetAttributeValue.

Joao
XML_GetAttributeValue is returning only the tag values of the xml, but I want xml tags along with the values in the xml tags. I thought it would work.
And also, I don't think XML_GetAttributeValue() can be used to get the xml in the specified xpath. This method is used to retrieve attribute values.
Hi Raj,

Do you want to save generated xml document as one text file from selected node ?
Hello Raj,

You can use OTHER ACTIONS in the extension to retrieve the XML tags and use XPath expressions.
You need to look at the list of actions in the XML extension to find what you are looking for.

Joao
Suraj Borade wrote:
Hi Raj,

Do you want to save generated xml document as one text file from selected node ?
 
 Yes Suraj, I want merge two xmls and want to save the final xml as text.
João Santos wrote:
Hello Raj,

You can use OTHER ACTIONS in the extension to retrieve the XML tags and use XPath expressions.
You need to look at the list of actions in the XML extension to find what you are looking for.

Joao
 Hey João Santos,

Thanks for your reply.

As you said may be I am missing something. My requirement is simple, I want to merge 2 xmls(xml1 and xml2).
Get subset of xml1 using xpath and append it to xml2 at a specified path and finally convert the xml3 to text.

I hope this can be achieved using XML extension. But I am going clueless by looking at the bigger picture of my goal. If possible can you give some clues?
 
I haven't done exactly what you are asking for. Looking at the XML extension methods, I would try XMLDocument_SelectSingleNode, XMLDocument_New, XMLDocument_CreateRootElement, XML_AppendChildElement, and XMLDocument_Save.
A XSL_Transform may simplify some of the steps.
That's as much as I can try to help. 

HI João Santos,

I tried to achieve my goal, but it is not possible to achieve the same with XML extension methods.
Any way thanks for your reply.