Hi all,
  I could solve this problem. I had not made some entries in the file,
XSAttributeChecker.java (for, allocation of memory for the attributes)
which was causing this problem.

Now the code I have written can recognize, 0-n xs:assert children of
<xs:complexType> (as per the grammar specified in the spec) and I am
getting error messages in case of wrong syntax.

I am happy to say, a good framework for assertions support is done from my end.

I have modified / created the following files,

package org.apache.xerces.impl.xs
-> SchemaGrammar.java
-> SchemaSymbols.java
-> XSComplexTypeDecl.java

package org.apache.xerces.xs
-> XSAssert.java (new, interface)
-> XSConstants.java

package org.apache.xerces.impl.xs.assertion (new, package)
-> Test.java (representing, "test" attribute)
-> XSAssertImpl.java

package org.apache.xerces.impl.xs.traversers
-> XSAttributeChecker.java
-> XSDComplexTypeTraverser.java

I would really like the Xerces team to review my work at this stage,
so you could validate that I am on the right path, and suggest future
directions.

How could I submit the above files, for getting them reviewed by the
Xerces team?

Some further work I see that still need to be done for xs:assert support is,
1) Correcting few error messages, to reflect the correct context.
2) Handling some Java level exception traces to proper Xerces exceptions.
3) Testing xs:assert on <xs:restriction and <xs:extension. I have
presently tested asserts as direct children of xs:complexType.
4) XPath 2.0 processing (which is an open issue at the moment).

Waiting for reply from the team ...


On 7/26/08, Mukul Gandhi <[EMAIL PROTECTED]> wrote:
> Hi all,
>   I am implementing assertions support in Xerces, as per the XML
> Schema 1.1 spec. I have written quite a bit of code upto now for this.
>
> As guided by the XML Schema 1.1 language, I have modified the file,
> XSDComplexTypeTraverser.java of Xerces.
>
> I have added a method,
> private void traverseAssertions(Element assertElement,
>            XSDocumentInfo schemaDoc, SchemaGrammar grammar)
>            throws ComplexTypeRecoverableError
>
> in XSDComplexTypeTraverser.java
>
> I have done some testing. There are no compilation errors in the
> Xerces code base after I have made the changes, and I am able to
> export a JAR (something, like xercesImpl.jar) which I am able to test.
>
> For testing, when I add, <xs:assert test="abc" /> as a child of,
> <xs:complexType> in a sample document, and run the new Xerces code I
> have written, the execution does go into the method,
> traverseAssertions (which I have been able to accomplish).
>
> At the beginning of this method, I have written a code like (copied
> from Xerces itself),
>
> Object[] attrValues = fAttrChecker.checkAttributes(assertElement,
>                false, schemaDoc);
> String test = (String) attrValues[XSAttributeChecker.ATTIDX_XPATH]; //XX
>
> This will retrieve the attribute values of xs:assert element.
>
> But I am getting null pointer exception at, line XX. The object
> attrValues is coming as null. And the execution halts after this.
>
> I have been debugging (the cause of null pointer exception) since past
> few hours for this, but not been able to find the solution.
>
> Can somebody please help, so I could proceed further with implementation.
>
> I am really hoping I can complete assertions support (without, XPath
> processing for now) quite soon.


-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to