Hi, thanks in advance for any help. I have an xml file and use javascript/XPath to pull data to an HTML page. In XML Spy, using XPath evaluator, the below XPath returns the appropriate value. However, in the browser, I get 'object required'.
First, I select a single level1 node based on it's id attribute, using
var node = nodes.selectSingleNode("//root/level1[@id=1]");
This works fine. Next I try to select a single node's value from within that node, using
innerNodeVal = node.selectSingleNode("//level1/level2/level3/level4[@id=1]/wanted node").text;
Any thoughts? Putting just 1 slash or 0 slashes at the beginning of the XPath string doesn't solve it, but all work in XML Spy.
Thanks again,
Iain
First, I select a single level1 node based on it's id attribute, using
var node = nodes.selectSingleNode("//root/level1[@id=1]");
This works fine. Next I try to select a single node's value from within that node, using
innerNodeVal = node.selectSingleNode("//level1/level2/level3/level4[@id=1]/wanted node").text;
Any thoughts? Putting just 1 slash or 0 slashes at the beginning of the XPath string doesn't solve it, but all work in XML Spy.
Thanks again,
Iain