Skip to content
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

Confusion: Unexpectedly XPath seach starts at wrong element #10

Open
GoogleCodeExporter opened this issue Mar 18, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

Further elaborating at http://code.google.com/p/omnixml/issues/detail?id=9

~~~~~~ Node ~~~~~
  <hasp id="1299527092" type="HASP-HL">
    <feature id="0" />
    <feature id="16" />
    <vendor id="54321"/>
    <license_manager >
      <ip>127.0.0.1</ip>
      <osname>Windows 7 Professional</osname>
    </license_manager>
  </hasp>

I try to extract values using expressions like
"hasp/license_manager/ip"
"hasp/vendor/@id"
"hasp/@id"

Correct results returned by

  1. http://www.freeformatter.com/xpath-tester.html
  2. http://xpath.online-toolz.com/tools/xpath-editor.php
  3. http://www.softpedia.com/get/Programming/File-Editors/XMLPad.shtml

No matches returned by OmniXML XPathSelect

However the broken expressions
"license_manager/ip"
"vendor/@id"
"@id"

Extract correct results in OmniXML and no results in reference tools

From the hindsight, the reference tools (that are normally used to debug and
settle the expressions), so they kind add invisible virtual "document-root)
node on top of it. While OmniXML works inside the node with the document.
But that is very confusing and unexpected.

I'd propose to add
XPathSelect(NodeList, expression) overload
and
XPathSelect(Node, expression, TreatAsDocument: boolean = false)
or XPathSelectAsDoc(Node, expression)

To make transplanting expressions from editors/debuggers into sources easier


Original issue reported on code.google.com by `[email protected]` on 10 Dec 2014 at 2:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant