Hi
I am new to castor and XML in general:
I am running into the following problem during code generation from XSD
(sorry this mail is really long)
Modified properties file.
-------------------------------------
org.exolab.castor.parser.validation=true
org.exolab.castor.parser.namespaces=false
# True if all documents should be validated by the marshalling framework
#
org.exolab.castor.marshalling.validation=true
----------------------------------------
The error I message I get is :
/space/j2sdk1_3_1_02/bin/java org.exolab.castor.builder.SourceGenerator -i topology-response.xsd -package foo
SAXParseException: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'xs:schema'.
- occured at line 2, column 56
The XSD used is attached.
I also tried to modify the Configuration.java class to set the following :
( (XMLReader) parser ).setFeature(
"http://apache.org/xml/features/validation/schema", true);
( (XMLReader) parser ).setFeature(
"http://xml.org/sax/features/namespaces",
true);
Based on some info I read from Castor and Xerces support groups. I have tried using different versions of xerces parsers , the one attached with castor and xerces-2.0.1. Irrespective of the parser, I run into this problem.
I don't run into this problem when parser.validation is turned off.
I obeserved that the generated code with validation turned off in configuration but turned on during run time
doesn't enforce 'sequence' order when unmarshalling data.
My code reads like :
Unmarshaller um = new Unmarshaller(Reply.class);
um.setValidation(true);
reply = (Reply)um.unmarshal(reader);
Reply is a complex type say with element sequence "ctag" and "response"
So a valid instance document should have :
<reply>
<ctag>foo</ctag>
<response>1</response>
</reply>
But UnMarshaller allows :
<reply>
<response>1</response>
<ctag>foo</ctag>
</reply>
<<topology-response.xsd>>
I am sure I am missing something and wondering if anyone can shed some light.
Thanks for the help in advance,
Uma.
topology-response.xsd
Description: topology-response.xsd