简体   繁体   中英

How to convert XML into string in Wso2

Scenario I've a use case where I've XML tags as shown, I need to convert the complete XML as a single string but don't want to stringify them because it then converts the tags < > as &lt; &gt;

XML

<VERIFICATION>
  <USER_VERIFICATION>
    <USERNAME>XXXX</USERNAME>
    <PASSWORD>XXXXX</PASSWORD>
  </USER_VERIFICATION>
  <REQUEST_DATA>
    <TRANSACTION_ID>XXXXX</TRANSACTION_ID>
    <SESSION_ID/>
    <CITIZEN_NUMBER>160XXXXX</CITIZEN_NUMBER>
    <CONTACT_NUMBER>033XXXX</CONTACT_NUMBER>
    <AREA_NAME>khyber-pakhtunkhwa</AREA_NAME>
  </REQUEST_DATA>
</VERIFICATION>

Question

My question is how do I convert the XML to string without affecting the angle tags?

Place them within a CDATA tag.

<![CDATA[YOUR XML]]>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM