Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] Schema aware XPath 2.0 evaluation with PsychoPath


I've copied Andrea Bittau on this message as he was the original author that donated us the code. I will say this, I have not tried the XML Schema awarness beyond the built in simple type support that it has. The W3C Test Suite does have some tests for this, but I have not made it that far through creating the necessary unit tests to start testing.

Currently I do not think that it is checking or testing correctly against the ComplexTypes or extension on Simple Types defined within the grammar it self. I suspect we have some work and enhancement to do in this area to implement full XML Schema support beyond the built in types that are already supported. The XPath Data Model specification has more information on how and when this should be constructed.


Mukul Gandhi wrote:
Hi PsychoPath team,
  I need some help in running the Schema aware XPath 2.0 expressions
with PsychoPath.

After looking at the PsychoPath source code in this regard, I can see
that we have a framework in place (using Xerces XSModel) to evaluate
schema aware XPath expressions.

For e.g., if my Schema has an attribute declaration:

<xs:attribute name="startdate" type="xs:date" />

Then, I want something like below to succeed:

@startdate gt xs:date('2008-01-31')

The operator 'gt' must consider @startdate to have type annotation
xs:date, and make a type aware XPath evaluation.

Currently, I get an Exception when I try to evaluate the above expression [1].

In PsychoPath sources, implementation of 'gt operator looks like following:

public boolean eq(AnyType arg) throws DynamicError {
    XSDate val = (XSDate) NumericType.get_single_type(arg, XSDate.class);

    return calendar().equals(val.calendar());

public static AnyType get_single_type(AnyType at, Class type)
			                           throws DynamicError {		
    if (!type.isInstance(at))

    return at;

An expression like, [1] above fails because, method 'get_single_type'
raises an Exception if the operand is not of type say XSDate. If the
argument to 'gt' is a node, PsychoPath must "atomize" the node and
used the atomized value for comparison. Currently this doesn't seem to
be happening in PsychoPath.

This looks like a possible bug to me, in PsychoPath relating to schema

I am keen to solve this problem (I could even try to solve this bug),
if I get guidance from the PsychoPath team, about how to approach this

Back to the top