-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when defaultnamespace #36
Comments
Unlike XML, XPath 1.0 does not have a concept of default namespaces:
The behavior you are seeing is expected and it is the same behavior you would see in any XPath 1.0 compliant engine: http://stackoverflow.com/questions/29412083/getting-all-entry-elements-within-a-namespace-from-xml-using-xpath I'm not sure what to advise you as far as your tool goes, but even if this library allowed using default namespaces, that would just mean that your tool would be allowing your users to test incorrect XPaths. I noticed on your README page that your tool is planned to support XPath 2.0. XPath 2.0 does have a concept of default namespaces, but this is not an XPath 2.0 library. Perhaps you might be better served using an XPath 2.0 library? I know that there are a few out there: https://github.com/ilinsky/xpath.js |
I'm using your library as a base from my xpath-tool, that you can watch here: https://github.com/alexandrev/xpath-tool but I'm facing an issue when you have a default namespace. I'm adding the namespace using the useNamespace function but with no prefix ("") as it has been stored on the nsMap from xmldom when it parses the document. So then when I write the xpath expression I mean to use default namespace but it doesn't seem that is working. A real example:
XML Document
The namespace I add using usenamespace functions it is hte following JSON:
{"": "http://schemas.microsoft.com/project"}
But after all that set up the xpath expression
//Project
doesn't return anything!Please, take a look and if you need more help or info from my side, let me know!
The text was updated successfully, but these errors were encountered: