We are currently using Castor to un/marshal our XML, using a DTD for validation. We are considering moving over to a schema instead.
I have encountered an issue when Castor appears to be looking through
the mapping file for a specific field, which is mapped from a simple XML
element. The field has been declared along with its parent class, as
these are known to work with the DTD.
We have been able to trace the issue down to what appears to be a
specific combination of fields, mapped to attributes and elements.
Enclosed are sample XML files which when run through the enclosed test,
trigger the exception (org.exolab.castor.xml.MarshalException: unable to
find FieldDescriptor for ... in ClassDescriptor of ...{File: [not
available]; line: 8; column: 13}).
Regards,
Mark
CastorMappingTest.java
Description: CastorMappingTest.java
Baldrick.java
Description: Baldrick.java
Blackadder.java
Description: Blackadder.java
<?xml version="1.0" encoding="UTF-8"?> <mapping> <class name="Blackadder"> <map-to xml="Blackadder" /> <field name="baldrick" type="Baldrick" required="true" > <bind-xml auto-naming="deriveByClass" node="element" /> </field> <field name="bob" type="string" required="false"> <bind-xml name="Bob" node="attribute" /> </field> </class> <class name="Baldrick"> <map-to xml="Baldrick" /> <field name="george" type="string" required="true"> <bind-xml name="George" node="attribute" /> </field> <field name="melchett" type="string" required="true"> <bind-xml name="Melchett" node="element" /> </field> <field name="darling" type="string" required="true"> <bind-xml name="Darling" node="element" /> </field> </class> </mapping>
<?xml version="1.0" encoding="UTF-8"?> <Blackadder xmlns="http://www.example.org/castor_mapping_test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/castor_mapping_test http://www.example.org/castor_mapping_test" Bob="is_a_girl" > <Baldrick George="Our new shells"> <Melchett>0001</Melchett> <Darling>000000633597007C1234567103E00001</Darling> </Baldrick> <Baldrick George="New product accounts"> <Melchett>0120</Melchett> <Darling>0120,03E00001,ABCDEF,30-Oct-2006 13:33:44,1234</Darling> </Baldrick> <Baldrick George="New product accounts"> <Melchett>0200</Melchett> <Darling>0200,03E00001,ABCDF0,30-Oct-2006 13:33:45</Darling> </Baldrick> <Baldrick George="Product account updates"> <Melchett>0106</Melchett> <Darling>03E00001,ABCDEF,30-Oct-2006 15:55:66,1234</Darling> </Baldrick> </Blackadder>
castor_mapping_test_schema.xsd
Description: castor_mapping_test_schema.xsd
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email

