Skip to main content

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

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:

[1]
@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))
       DynamicError.throw_type_error();

    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
awareness.

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
problem.


-- 
Regards,
Mukul Gandhi


Back to the top