Hi Michael, This seems to be a very nice idea. Presently, the assertions XPath expressions are compiled each time an assertion is evaluated. As you rightly explained, this looks certainly expensive (and infact I feel, this can become quite expensive for large XML trees with repeating XML fragments, whose XSD types may define assertions).
The optimization you have suggested seems doable and looks even conceptually simple to implement. I think, we can store the complied assert XPath expression, in XPath20Assert.java where we are presently keeping a XPath string representation. This new design looks to me, a quite optimized implementation, and would likely save a significant runtime cost. It looks to me that, it might be easier to store the XSD namespace prefix in the object, XSAssertImpl. We can populate this information while performing the assertions traversal actions on the XSD simple and complex types. This looks achievable to me. Can I begin doing these improvements? Any more suggestions regarding these issues, would be great :) On Fri, Nov 13, 2009 at 11:41 AM, Michael Glavassevich <[email protected]> wrote: > Hi Mukul, > > I had a deeper look at what's currently in SVN and it's quite different than > what I would have expected to see, perhaps in part due to the design of > PsychoPath. I was hoping to find a separation between the parsing / > processing of the XPath expressions and their evaluation during schema > validation, with the work for the XPath parsing / processing being done once > during schema loading (or deferred until it's actually needed). This is a > pattern supported by the JAXP XPath API, where you compile [1] an XPath > expression and use / reuse this compiled expression for evaluation [2] many > times. The compilation step is potentially expensive but you only pay for > this cost once. > > It seems that we pay for the XPath parsing every time we evaluate an > expression. I can't imagine that would have good performance. I'm hoping > that there's a better way of doing this where the parsing of the XPath > expression is done during schema loading which is also the best place to be > pulling the namespace bindings from the schema document. > > What do you think? > > Thanks. > > [1] > http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/xpath/XPath.html#compile(java.lang.String) > [2] > http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/xpath/XPathExpression.html#evaluate(java.lang.Object) > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [email protected] > E-mail: [email protected] -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
