- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 12:33 AM
Can anyone confirm if this method still can be used in Helsinkin?
I have tried exact same samples in a script include and BR not returning any value.
http://wiki.servicenow.com/index.php?title=XMLDocument_Script_Object#gsc.tab=0
xmldoc.getNodes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 07:55 AM
Yes, it worked for me, with small modifications:
var xmlString = "<test>" +
" <one>" +
" <two att=\"xxx\">abcd1234</two>" +
" <three boo=\"yah\" att=\"yyy\">1234abcd</three>" +
" <two>another</two>" +
" </one>" +
" <number>1234</number>" +
"</test>";
var xmldoc = new XMLDocument(xmlString);
var nodelist = xmldoc.getNodes("//one/*"); // two, three, and two
gs.log(nodelist.getLength());
gs.log(nodelist.item(0).getNodeName());
gs.log(nodelist.item(1).getNodeName());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 06:47 AM
Hi Jesus,
Show be supported. You can find the same doc under Istanbul release. Normally, SN does not remove features, might stop support, but rarely removes features.
Regards,
Guillermo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 07:50 AM
were you able to test it in background scripts?
It doesn't work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 07:55 AM
Yes, it worked for me, with small modifications:
var xmlString = "<test>" +
" <one>" +
" <two att=\"xxx\">abcd1234</two>" +
" <three boo=\"yah\" att=\"yyy\">1234abcd</three>" +
" <two>another</two>" +
" </one>" +
" <number>1234</number>" +
"</test>";
var xmldoc = new XMLDocument(xmlString);
var nodelist = xmldoc.getNodes("//one/*"); // two, three, and two
gs.log(nodelist.getLength());
gs.log(nodelist.item(0).getNodeName());
gs.log(nodelist.item(1).getNodeName());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 09:22 AM
For some reasons this particular line var nodelist = xmldoc.getNodes("//name/*") won't run on my code and I am suspecting it could be one of the following reasons
1) I am using client callable script include
2) It is scoped application
3) my xmlDoc is an instance of XMLDocument2(); instead of XMLDocument() as you have it there.