Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath selection inconsistencies

From: "J" <jason.jones@-----.--->
To: NULL
Date: 9/1/2006 10:07:00 AM

>
> Can you post some VB6 code for a repro?
>

Unfortunately, I can't, really.  The code that is experiencing the
error is essentially something like:

private function foo()
     Dim doc as DOMDocument40
     Dim nl As IXMLDOMNodeList

     Set doc = new DOMDocument40
     doc.LoadXML(str);    'str: Use the XML text above

     Set doc = AddAndRemoveNodes(doc)

     'The symptom appears here:
     'This returns no nodes
     Set nl = doc.selectNodes("a/b[c/d='5678']")

     'This will return exactly what we expect
     Set nl = doc.selectNodes("a/b[c/d[text()='5678']]")
end function


The problem, of course is in the AddAndRemoveNodes function, which
really is just a pseudocode abstraction for more code than I can
reasonably produce for you here.

What I can tell you, is that after the AddAndRemoveNodes routine, if I
save the DOM to disk, and reload it into the doc, both XPath selections
will work identically ('correctly').  It is when I use the DOM in the
state it is in after that routine that I have trouble.

A coworker has suggested that the implementation of the DOM may be
using some internal indexing to speed up the XPath selection, which
becomes corrupted.  Under this theory, perhaps a predicate of the form
"[c/d='...']" uses that internal (presumably corrupted) indexing, and
produces an incorrect result (in this case, no result at all).  Perhaps
then, the text() function, for whatever reason, must bypass that
indexing, performing the expected recursive search, and producing the
correct result.

This all sounds reasonable to me.  But it is all conjecture.  I have
been unable to find any  documentation of this sort of behavior, and
was hoping someone else had...

Thanks for any help,

J



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent