![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XPath selection inconsistencies >Thread Next - Re: XPath selection inconsistencies Re: XPath selection inconsistenciesTo: NULL Date: 9/2/2006 9:11:00 AM
I have seen something similar happen when the new nodes are added from a
separate document without using cloneNode or importNode.
--
Joe Fawcett - XML MVP
http://joe.fawcett.name
"J" <jason.jones@s...> wrote in message
news:1157130403.995886.123150@h......
> >
>> 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
>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
