parsing a XML document

naresh1019
Mega Expert

can you please guide me on this.

1) I created a Soap OutBound Message.

2) recieved a long response(xml) for a given request.

3) i want to put this in a scheduled job.

4) I want to extract the a single node data from that and push it into cutom table.

5) I copied the preview script and pasted in scheduled script.

5) I want to parse the xml data and extrat the contents of the perticular node.

find_real_file.png

Please guide me on extracting the node data.

find_real_file.png

14 REPLIES 14

Make use of XMLHelper



XMLHelper



var helper =new XMLHelper(xmlString);
var obj = helper.toObject();

logObj
(obj,"*")function logObj(obj, sep){
   
for(x in obj){
   
if(typeof obj[x]!="function"){
  gs
.log(sep + x +":: "+ obj[x]);}   //here x is the tag, obj[x] is the tag value
  logObj
(obj[x], sep +"*");}}


Check this for XMLDocument:



XMLDocument script object


Cam I have your whats app number......if you don't mind.



On Dec 15, 2017 1:47 AM, "gowrisankar" <community-no-reply@servicenow.com>


naresh1019
Mega Expert

Can you please gu ide further....for your first response i am getting null value


naresh1019
Mega Expert

Hey I got the firstfield .....similarly i want read multiple fields......please guide me.......i mean there are 20 portfolios ...so how to capture all ...is it by using for loop.