- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 10:40 AM
I have XML :
var xmlString = "<?xml version='1.0' encoding='UTF-8'?>"+
"<parameters><parameter name='message_header' value='head123'/>"
"<parameter name='message_content1' value='content123'/>"+
"<parameter name='message_content2' value='content456'/></parameters>";
How I can get note value in the script? e.g. get 'message_content2' value 'content456'.
Thanks,
Faye
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2018 07:30 PM
It's more than 2 weeks now, but got some time to look into this. Let try with below code, hope this will help. I was able to print the value in background script.
var xmlString = "<?xml version='1.0' encoding='UTF-8'?>"+
"<parameters>"+
"<parameter name='message_header' value='head123'/>" +
"<parameter name='message_content1' value='content123'/>"+
"<parameter name='message_content2' value='content456'/>" +
"</parameters>";
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(xmlString);
var iter = xmlDoc.getNode("//parameters").getChildNodeIterator();
while(iter.hasNext()){
var n = iter.next();
var xmlDoc1 = new XMLDocument2();
xmlDoc1.parseXML(n);
var node = xmlDoc1.getNode("//parameter");
var nodeValue = node.toString().split(' ')[2].split('=')[1].replace(/[^a-zA-Z0-9]/g, "");
gs.print(nodeValue);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 10:46 AM
Please check if this helps: XML APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:08 AM
Thanks Shishir. Not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 01:09 PM
Hey Faye,
might be helpful to you.
Please Refer:
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 03:01 PM
Thanks Rajesh.
But it doesn't work.
Thanks,
Faye