[xmljs-users] Comparision values returned by getAttribute()
Brought to you by:
djoham,
witchhunter
From: <san...@ya...> - 2005-03-24 20:12:34
|
It seems like comparing the string value returned by getAttribute() always results in failure even though they have the same value: <HTML> <head> <title>Test</title> </head> <script src="../jsXMLParser/xmlw3cdom.js"></script> <script src="../jsXMLParser/xmlsax.js"></script> <script> function foo(){ var strXML = "<root id=\"root\"><child id=\"child1\"/><child id=\"child1\"/></root>"; //instantiate the W3C DOM Parser var parser = new DOMImplementation(); //load the XML into the parser and get the DOMDocument var domDoc = parser.loadXML(strXML); var children = domDoc.getDocumentElement().getChildNodes(); var str1 = children.item(0).getAttribute("id"); var str2 = children.item(1).getAttribute("id") alert ("str1 = " + str1 + ", str2 = " + str2); alert(str1 == str2); //always false <======== } </script> <BODY onload="foo()"> </BODY> </HTML> Why is this? Is there a way around this? thanks. Sanjeev |