You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "K.Kawaguchi" <kk...@kohsuke.org> on 2003/11/10 22:44:08 UTC

XPathMatcher bug

Currently, the XPathMatcher matching algorithm does not properly handle
expressions like:

    .//a/b/@id

against XML like:

    <a>
      <a>
        <b id="xyz" />
      </a>
    </a>

The reason is, as soon as XPathMatcher sees the first <a>, it "consumes"
the ".//a" part, and when it sees the next <a>, it will never realize
that it should match this <a> against ".//a".

I have another matching algorithm that I use for my schema validator (which
is roughly outlined in [1].)  I can rewrite the algorithm to do matching
in this way to solve the problem.

If allowed, I'd also like to change relevant code so that one matcher
works against one XPath.LocationPath. This will make the code simpler,
and as a nice extra, it should also result in slightly faster code in
typical cases where the XPath contains only one location path.


Is this something Xerces would consider accepting as a patch? Or do
people prefer other ways of fixing this problem? Is this going to raise
many eyebrows?

I just wanted to get some feel of how people think before I start
working on it.


[1] https://msv.dev.java.net/source/browse/msv/msv/src/com/sun/msv/verifier/identity/PathMatcher.java?rev=1.5&content-type=text/vnd.viewcvs-markup

regards,
----------------------
Kohsuke Kawaguchi
E-Mail: kk@kohsuke.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org