I'm using a 0.9.4.1 binary compiled from CVS this morning (which I understand is basically 0.9.4.2). I'm trying to generate sources from a very simple schema.

Schema:
<?xml version="1.0" encoding="UTF-8"?>
<schema
	targetNamespace="urn:test:namespace" 
	xmlns="http://www.w3.org/2001/XMLSchema" 
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified">

	<complexType name="Test1Type">
		<sequence>
			<element name="Test2" type="string">
				<complexType>
					<sequence>
						<element name="Test3" type="string"/>
					</sequence>
				</complexType>
			</element>
		</sequence>
	</complexType>
</schema>

castorbuilder.properties:
org.exolab.castor.builder.nspackages=urn:test:namespace=test
org.exolab.castor.builder.javaclassmapping=type
command line:
java -cp .:/usr/local/java/castor/castor.jar:/usr/local/java/xerces-2_2_1/xmlParserAPIs.jar:/usr/local/java/xerces-2_2_1/xercesImpl.jar org.exolab.castor.builder.SourceGenerator -i test.xsd -dest src -f -types j2 -verbose
error message:
-- Suppressing non fatal warnings.
Creating classes for: Test1Type
Exception in thread "main" java.lang.IllegalArgumentException: 'null' is a reserved word and may not be used as  a class name.
        at org.exolab.javasource.JStructure.<init>(JStructure.java:143)
        at org.exolab.javasource.JClass.<init>(JClass.java:117)
        at org.exolab.castor.builder.MemberFactory.createFieldInfo(MemberFactory.java:222)
        at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1323)
        at org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactory.java:1358)
        at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1292)
        at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:323)
        at org.exolab.castor.builder.SourceGenerator.processComplexType(SourceGenerator.java:1274)
        at org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerator.java:1174)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:479)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:538)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:569)
        at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:1118)

Now, the strange part is, if I edit castorbuilder.properties and remove the namespace-to-package mapping (ie. comment out the first line), then the above schema compiles fine.

This is with JDK 1.3.1_06 on RH Linux 8.0.

If I could turn on more debugging in the SourceGenerator I could provide more info. But the above example is short enough that I think anyone could easily recreate it.

Thanks,

Bryan



Reply via email to