- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2018 08:55 AM
<res0:value>
<ns4:id xmlns:ns4="urn:v3.diagnostic.dar.services.bgc">20182300020601349</ns4:id>
<ns4:globalResult xmlns:ns4="urn:v3.diagnostic.dar.services.bgc">Done</ns4:globalResult>
<ns4:detailedResultsBlock xmlns:ns4="urn:v3.diagnostic.dar.services.bgc">
<ns4:id>20182300020601349</ns4:id>
<ns4:result name="PABX" time="2018-06-08T17:24:36.954+02:00">No or private PABX.</ns4:result>
<ns4:result name="Dare missing information" time="2018-06-08T17:24:36.954+02:00">Dare PTS potentially impacted by missing information from: ABR TSI, OSS network and services</ns4:result>
<ns4:result name="Physical layer and connectivity"
time="2018-06-08T17:24:36.954+02:00">The DSL line of the customer is in synch and quality is OK.</ns4:result>
<ns4:result name="General information" time="2018-06-08T17:24:36.954+02:00">No general issues found.</ns4:result>
</ns4:detailedResultsBlock>
</res0:value>
Any help is much appreciated. Thank You!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2018 12:40 AM
I found a workaround for the issue. Here's the code.
Suppose your XML is in a variable called responseBody
var xmlString = responseBody.toString();
var xmlClean = global.JSUtil.unescapeText(xmlString);
JSUtils is an OOB Script Include already present in every instance.
The xmlClean (String) is free from < and >
To convert it back to XML, use this code:
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(xmlClean);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2018 11:55 PM
Hi Nawshi,
So you want the following:
< -> to be replaced with <
> -> to be replaced with >
use below script and it will replace:
var data = ''; // your xml string
data = data.replaceAll("<","<");
data = data.replaceAll(">",">");
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2018 12:43 AM
Hi Ankur,
replace works only with String, the Xml in question is an XML Object. I found a workaround and I have mentioned in the answer to this question. Thanks anyway!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2018 12:40 AM
I found a workaround for the issue. Here's the code.
Suppose your XML is in a variable called responseBody
var xmlString = responseBody.toString();
var xmlClean = global.JSUtil.unescapeText(xmlString);
JSUtils is an OOB Script Include already present in every instance.
The xmlClean (String) is free from < and >
To convert it back to XML, use this code:
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(xmlClean);