I use the SourceGenerator to create the classes for the following XMLSchema
fragment.
<element name='Description'>
<complexType mixed='true'>
<sequence minOccurs='0' maxOccurs='unbounded'>
<element ref='ShortName'/>
</sequence>
<attribute name='xml:lang' type='string' use='required'/>
</complexType>
</element>
When I try to unmarshal the following XML
<Description xml:lang="en">
foo bar foo bar foo bar
<ShortName>My shortname </ShortName>
</Description>
I get the following error
Illegal Text data found as child of: Description
value: "
foo bar foo bar foo bar
"
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:443)
at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
.java:1436)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1205)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:391)
at com.cascadeworks.app.cXML.protocol.CXML.unmarshal(CXML.java:226)
at com.cascadeworks.app.cXML.protocol.Main.main(Main.java:35)
I don't know about anybody else, but it seems like Castor is unable to
support mixed types of the sort above. The SourceGenerator seems to do the
right thing, creating an _item ArrayList in my Description class, which
should contain a list of DescriptionItem objects (also generated) that
contains _content and _shortName. The problem is that when Castor tries to
unmarshal the XML, it blows up.
Am I doing something strange here? It seems relatively straightforward to
me. I've been combing through the code to try to figure out how to fix
this, and have come across nothing yet. I've also looked through the e-mail
archive.
Note that I cannot use <any> here, because <any> requires that everything be
enclosed in a tag (for some reason). Also, Castor does not support the
type='anyType' that I can find.
BTW, I ran into a similar problem with the new JAXB early release (besides
the fact that it only supports DTDs, it is reasonably nice). It couldn't
handle this type of mixed content either. I was hoping Castor could.
If anybody has any ideas on how to continue, it would be much appreciated.
jvc
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev