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]

Mukul Gandhi <[email protected]> wrote on 11/12/2009 06:56:55 AM:

> Hi Michael,
>    I think, I need to get XSD namespace prefix within
> XMLSchemaValidator, so that I can pass it to the PsychoPath interface.
>
> To get the XSD namespace prefix, I was thinking to somehow access the
> XSDocumentInfo object within XMLSchemaValidator.java. Getting XSD
> namespace prefix from XSDocumentInfo is possible via, the object
> "protected Element fSchemaElement", which is the root of XSD document
> tree.
>
> But looking at the Xerces code for a while, I cannot find a means to
> get access to XSDocumentInfo object from within XMLSchemaValidator.
>
> Could you please suggest, what will be the correct approach to do this
> (i.e, accessing XSD namespace prefix from within XMLSchemaValidator)?
>
> On Thu, Nov 12, 2009 at 2:35 AM, Michael Glavassevich
> <[email protected]> wrote:
> > Hi Mukul,
> >
> > As you've noted "http://www.w3.org/2001/XMLSchema" can be bound to
other
> > prefixes than "xs".  Also, "xs" could be bound to something other than
> > "http://www.w3.org/2001/XMLSchema" or not be declared at all.
> >
> > We should not be hard-coding the namespace bindings. For each XPath
> > expression they should be determined from the namespace context of the
> > schema we're processing and I believe also the and the
> > "xpathDefaultNamespace" attribute which might be on the "assertion" or
> > "schema" element if the assertion doesn't have one. Doing anything else
is
> > incorrect.
> >
> > Thanks.
> >
> > 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]

Reply via email to