Google Summer of Code 2008 - Project Proposal
Implementing Conditional Type Assignment for Xerces2-J
Apache Xerces2 is a high-performance, standard complaint XML parser. It is a nearly complete rewrite of the Xerces 1.x code base to make it cleaner, more modular and more maintainable. Xerces2 currently supports XML 1.0, XML 1.1, DOM (Document Object Model), JAXP (Java APIs for XML Processing), SAX (Simple API for XML) and XML schema 1.0.
When a software system conforms to the standards and specifications that dictate the corresponding application domain, it becomes more usable and more and more users will gather around it. This is probably why the Xerces2 development team considers that it is important for Xerces2 to be fully standard compliant and continuously works towards achieving it. Anyway this has made Xerces2 a popular choice among application developers and currently a number of open source and proprietary software projects make use of Xerces2.
XML schema 1.1 is the latest version of XML schema standard published by W3C. Xerces2 development team is already working to get Xerces2 to support this new standard. The XML schema 1.1 standard is comprised of three main specifications, namely the primer, structures and data types. From these the XML schema – structures specification introduces a new concept called conditional type assignment. This allows a type to be assigned to an XML element based on the element’s attributes. In brief it enables an XML schema author to associate a condition and a type with an element in the schema. When the condition is met the corresponding type is assigned to the element.
The goal of this project is to design and implement the conditional type assignment feature for Apache Xerces2-J as one step of getting Xerces2 to support the XML schema 1.1 standard. This project will certainly improve Xerces2 in terms of standard compliancy and add more value to it.
Once conditional type assignment feature is implemented in Xerces2-J the XML schema authors will be able to define type alternatives where the association between the condition and the corresponding type is specified using an XPath expression as in the following example.
<xs:attribute name="kind" type="xs:string"/>
<xs:element name="value" type="valueType">
<xs:alternative test="@kind='int'" type="xs:int"/>
<xs:alternative test="@kind='short'" type="xs:short"/>
<xs:alternative test="@kind='byte'" type="xs:byte"/>
Implementing conditional type assignment would involve two components in Xerces2-J, namely XML schema traversal and XML schema validation.
As far as XML schema traversal is concerned, Xerces2-J should be able to handle the type alternative declarations in an XML schema. That means the parser should make sure the type alternative declarations conform to the restrictions imposed by the XML schema specifications. Also it should be able to read and process the XPath expressions and store them in a format that they can be easily evaluated during the XML schema validation process. In addition to that the parser should be able to map the types specified to a type defined in the XML schema.
When XML schema validation is concerned the parser should be able to retrieve any type alternatives defined for a particular element and evaluate the corresponding XPath expressions to determine the type of that particular element. Xerces2-J should also support associating multiple type alternatives for any given element (as in the above example). In case a particular element is associated with multiple type alternatives and the condition specified in the first XPath expression is not satisfied the parser should try to evaluate other XPath queries one-by-one to find the type of the element.
- Xerces2-J source code modified to support conditional type assignment
- Related test cases and one or more samples
- Related documentation
- 10th May 2008 – Complete reading the documentation and researching for the project
- 26th May 2008 – Complete planning and designing/Beginning to code
- 5th July 2008 – Finalize implementing the basic functionality
- 10th July 2008 – Submit workings for mid-term evaluation
- 11th August 2008 – Finalize implementing the advanced functionality, test cases and samples/demos
- 20th August 2008 – Submit workings for final evaluation
I’m Hiranya Jayathilaka from University of Moratuwa, Sri Lanka doing a major in Computer Science and Engineering and I’m getting ready to start the final year of my undergraduate course. I'm very passionate about open source software and am a regular Eclipse IDE user. I'm very competent in technologies like Java, PHP and Web services. I have also made a few contributions to the Apache Web services project, Apache Synapse project and WSO2 ESB project.
I believe that this project will be a golden opportunity for me to contribute to a world renowned open source project, make some new friends in the Apache Xerces community and also sharpen my skills as a prospective software engineer.
This project will be conducted within the Apache Xerces community and feedback from the community will be always valued and appreciated. I have already subscribed to the Xerces mailing list and awaiting approval to start a discussion regarding this project in the mailing list. I would always try to get my code reviewed by the expert developers in the mailing list and get them involved in the design decisions.