I have a schema that uses the "any" wildcard to represent an arbitrary block of xhtml:
<?xml version="1.0"?>
<xsd:schema elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xhtml="http://www.w3.org/TR/xhtml1"
xmlns="http://ov.hp.com/ium/namespace/test"
targetNamespace="http://ov.hp.com/ium/namespace/test"><xsd:element name="description">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:any processContents="skip" namespace="##any" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Given the following test document:
<?xml version="1.0" encoding="UTF-8" ?>
<description xmlns:xhtml="http://www.w3.org/TR/xhtml11" xmlns="http://ov.hp.com/ium/namespace/test">
<junk:p>basic html content</junk:p>
<p>basic html content</p>
<xhtml:p>basic html content</xhtml:p>
</description>
With castor 9.5.0 I cannot unmarshal this test document. I have problems parsing both the <p> and <xhtml:p> elements. I get:
org.xml.sax.SAXException: unable to find FieldDescriptor for 'p' in ClassDescriptor of description
at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1224)
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1214)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1171)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:555)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:487)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:627)
at Description.unmarshal(Description.java:247)
at Test.main(Test.java:21)
However, if I use the castor 9.4.3 version I get the following (expected) results:
<?xml version="1.0" encoding="UTF-8"?> <description xmlns="http://ov.hp.com/ium/namespace/test">
<junk:p>basic html content</junk:p>
<p>basic html content</p>
<xhtml:p xmlns:xhtml="http://www.w3.org/TR/xhtml11">basic html content</xhtml:p>
</description>
Is this a problem in castor 9.5? Do I need to do something different in my schema? I have tried setting various values for the namepsace but I get the same results.
I have enclosed a zip file with the schema, test xml and test program.
Thanks for any help!!! --tom
test.zip
Description: Zip compressed data
