Hi all,
   Just thought of sharing this example.

   Following is a simple example which could be used to test schema
aware XPath capabilities, related to the following patch:

https://issues.apache.org/jira/browse/XERCESJ-1365

XML file:
<person>
  <fname>Mukul</fname>
  <lname>Gandhi</lname>
  <dob>2006-10-10</dob>
  <developerId>XERCES100</developerId>
</person>

XSD file:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <xs:element name="person" type="PERSON"/>

  <xs:complexType name="PERSON">
    <xs:sequence>
          <xs:element name="fname" type="xs:string" />
          <xs:element name="lname" type="xs:string" />
          <xs:element name="dob" type="xs:date" />
          <xs:element name="developerId" type="IDTYPE" />
        </xs:sequence>
        <xs:assert test="dob gt xs:date('2005-12-10')" />
  </xs:complexType>

  <xs:simpleType name="IDTYPE">
     <xs:restriction base="xs:string">
        <xs:assertion test="starts-with($value, 'XERCES') and
(substring-after($value, 'XERCES') castable as xs:int)" />
     </xs:restriction>
  </xs:simpleType>

</xs:schema>

An assertion expression like, dob gt xs:date('2005-12-10') would
succeed, only if the XPath engine is schema aware, and we have a PSVI
enabled XDM tree. I am happy to say, that we have this capability now
in the Psychopath engine, and Xerces assertions.

Kindly use the latest Psychopath JAR that I provided today.

I would appreciate any feedback from the Xerces team about this.


-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to