M
Mariano
I will try to explain it better. Then, i've an XML document like this:
<utenti>
<utente username="mariano" id="1">
<password>prova</password>
<isAdmin>0</isAdmin>
</utente>
</utenti>
and i've a javascript function to parse it:
function myPath(xmlURL, pathString) {
var displayText;
if (window.XMLHttpRequest) { // mozilla
displayText = xmlURL.evaluate(pathString, xmlURL, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.nodeValue;
} else { // internet explorer
displayText = xmlURL.selectSingleNode(pathString).nodeValue;
}
return displayText;
}
OK. Now there's the question: two uses of the same function with
different path:
var pwd = myPath(xmldoc, "/utenti/utente[@username='mariano']/
password");
var usr = myPath(xmldoc, "/utenti/utente[@id='1']/@username");
First case print NULL, second correctly print MARIANO. Why the first
path return a null value? Both two functions works properly in xPath
Explorer. Thank you all...
<utenti>
<utente username="mariano" id="1">
<password>prova</password>
<isAdmin>0</isAdmin>
</utente>
</utenti>
and i've a javascript function to parse it:
function myPath(xmlURL, pathString) {
var displayText;
if (window.XMLHttpRequest) { // mozilla
displayText = xmlURL.evaluate(pathString, xmlURL, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.nodeValue;
} else { // internet explorer
displayText = xmlURL.selectSingleNode(pathString).nodeValue;
}
return displayText;
}
OK. Now there's the question: two uses of the same function with
different path:
var pwd = myPath(xmldoc, "/utenti/utente[@username='mariano']/
password");
var usr = myPath(xmldoc, "/utenti/utente[@id='1']/@username");
First case print NULL, second correctly print MARIANO. Why the first
path return a null value? Both two functions works properly in xPath
Explorer. Thank you all...