There is a slight error in the book regarding how to set namespace mappings for zXml which should be fixed for the next print run.
You need something like:
Code:
var namespace1 = "<namespace URI for na here>";
var namespace2 = "<namespace URI for pub here>";
var oNamespaceMapper = {na: namespace1, pub: namespace2};
var oRoot = oXmlDom.documentElement;
var sXPath = "na:book/pub:name";
var oNodes = zXPath.selectNodes(oRoot, sXPath, oNamespaceMapper);
if (oNodes.length > 0)
{
alert(oNodes.length + " nodes selected with '" + sXPath + "'");
}
You will need to replace the namespace declarations with the real ones.
--
Joe (
Microsoft MVP - XML)