Details
Description
If a schema contains both top level attributes and redefinitions, Castor will fail to parse the schema. The problem is caused by a simple code error in class org.exolab.castor.xml.schema,Schema at line #741. The solution is to remove this line of code.
To reproduce the problem, compile and run the attached java class by:
java TestCastorReader test.xsd
Got exception:
Exception in thread "main" java.util.NoSuchElementException: Hashtable Enumerator
at java.util.Hashtable$Enumerator.nextElement(Unknown Source)
at org.exolab.castor.xml.schema.Schema.getAttribute(Schema.java:742)
at org.exolab.castor.xml.schema.Schema.addAttribute(Schema.java:320)
at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:609)
at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:200)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.exolab.castor.xml.schema.reader.SchemaReader.read(SchemaReader.java:248)
at TestCastorReader.main(TestCastorReader.java:34)
In order to be able to replay this problem, you will have to supply me with abstract.xsd.