简体   繁体   中英

JavaScript: Namespace error when using xmlDoc.evaluate()

I'm trying to get an XPathResult object using the evalute() function on a xml document object:

var nodes= xmlDoc.evaluate(XMLPath,xmlDoc,null,XPathResult.ANY_TYPE,null);

even though the namespaceResolver parameter is null and I am using a very simple XML file without any name spaces declared, Firefox throws the following error on the line:

NamespaceError: An attempt was made to create or change an object in a way which is incorrect with regard to namespaces

Where is my error? Thanks in advance!

Ok, my bad. The error was hiding in the actual XPath I used. Problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM