users@jaxb.java.net

IllegalArgumentException

From: Dean Grossmith <dean.grossmith_at_ABERDEENPROPERTYINVESTORS.COM>
Date: Mon, 03 Feb 2003 10:03:08 -0700

I cannot generate a set of Java classes using xjc.bat. The stack trace is as follows:

parsing a schema...
Exception in thread "main" java.lang.IllegalArgumentException
        at com.sun.xml.xsom.impl.ElementDecl.<init>(ElementDecl.java:40)
        at com.sun.xml.xsom.impl.parser.state.elementDeclBody.makeResult(elementDeclBody.java:615)
        at com.sun.xml.xsom.impl.parser.state.elementDeclBody.text(elementDeclBody.java:419)
        at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.processPendingText(NGCCRuntime.java:188)
        at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement(NGCCRuntime.java:248)
        at org.xml.sax.helpers.XMLFilterImpl.endElement(Unknown Source)
        at org.xml.sax.helpers.XMLFilterImpl.endElement(Unknown Source)
        at org.xml.sax.helpers.XMLFilterImpl.endElement(Unknown Source)
        at org.iso_relax.verifier.impl.VerifierFilterImpl.endElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:222)
        at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:874)
        at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.java:591)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:747)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
        at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
        at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
        at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
        at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:151)
        at com.sun.xml.xsom.impl.parser.XSOMParser.parse(XSOMParser.java:116)
        at com.sun.tools.xjc.Driver.loadXMLSchemaGrammar(Driver.java:511)
        at com.sun.tools.xjc.Driver.loadGrammar(Driver.java:404)
        at com.sun.tools.xjc.Driver.run(Driver.java:268)
        at com.sun.tools.xjc.Driver.main(Driver.java:88)

This problem relates to the definition of a Custom element in my schema. If I remove this definition and all its uses then the compile completes successfully.

The Custom element is defined as follows:

 <xsd:element name = "Custom"/>

This error is not entirely unexpected given that any content is allowed. Is there a workaround?

Many thanks.

Dean Grossmith.