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)

  
Xml extension provided by Outsystems is compatible only for .NET platform ?

Actually, I came across this extension, when I was searching for the XML api to traverse through the xml using xpath. I tried to extract portion of xml using XmlElement_SelectSingleNode. Up to this point it is fine.

When I tried to extract the xml out of this XmlElement, I couldn't achieve this. I noticed that, the underlying object is XmlElementImpl and which is of .NET I think. I used Serialization_ObjectToXml method to 
convert XmlElement to Text, but it failed throwing the error. Is this the correct usage ?

How to convert XmlElement to text ?
Hi Raj,

The Xml extension is compatible with both stacks.
But the Serialization_* methods are not to be applied on any object, they are for very specific usages like explained in the methods description. Ex: Serialization_ObjectToXml says "Only records with single entities/structures are supported."

Looking at the Xml extension API I don't see any method that does what you want (extract the inner xml).
Can you explain a bit your use case so we can suggest you a better alternative?

Regards,
João Rosado
Hey João,

Thanks for your reply.

I am looking for a Xml API, which provides methods to alter the xml. I have a need where in I have to construct xml by extracting subset xml from another xml.

For eg: xml1 goes like this
<Application>
    ..............
    ...........
    <Applicant>
      <prefix></prefix
      <name></name>
      <suffix></suffix>
    </Applicant>
</Application>

xml2 goes  like this
<EmploymentDetails>
     <CurrentEmployment>
     </CurrentEmployment>
  ...........
   ..................
</EmploymentDetails>

I want final xml in such a way that, I want subsest of CurrentEmployment details from xml2 to be appended to xml1 in the <Applicant> section in the xml1.

Finally, the resultant xml should look like:

<Application>
..............
...........
<Applicant>
     <CurrentEmployment>
     </CurrentEmployment>
<prefix></prefix
<name></name>
<suffix></suffix>
</Applicant>
</Application>

Hope you got what I want. I can very well do it by splitting and appending, but I don't want to do because in our application we deal with very big xmls. It may result in performance overhead.

Can you please suggest better approach or alternative ?

Thanks
Raj