General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Unsable to get value of node from node list
-
russurquhart1 August 29, 2013 at 6:31 pm
Unsable to get value of node from node list
August 29, 2013 at 6:31 pmParticipants 1Replies 0Last Activity 9 years, 5 months agoHi,
I've used the getNodesByXPath to get nodes in the past, but in this case, where i want the text inside the node, i get either nothing (with .nodeValue) or undefined (with .data). The .nodeName produces the element name correctly. Here is the code i have:
var objNode = ActiveDocument.documentElement;
var nodelist = objNode.getNodesByXPath(“//PartNumber”);
Application.Alert(nodelist.length + ” PartNumber elements in this doc.”);
var nodecount = nodelist.length;
var all_the_rows = “”;if (Selection.CanInsert(“SubSection”))
{for (i=0; i
{
var current_PartNumber = nodelist.item(i);Application.Alert(“Node Name: ” + nodelist.item(i).nodeName);
Application.Alert(“Node Value: ” + nodelist.item(i).nodeValue);
Application.Alert(“Node Value: ” + nodelist.item(i).data);var current_PartNumber_Str = current_PartNumber.text;
var all_the_rows = all_the_rows + row_str;}
Can anyone provide some pointers to do this?
Thanks,
Russ
-
AuthorPosts
- You must be logged in to reply to this topic.