Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.1.1
-
Fix Version/s: None
-
Component/s: XML code generator
-
Labels:None
-
Environment:Windows XP Professional, Java 1.4.2_12-b03
-
Number of attachments :
Description
We are using castor-1.1.1, and java build 1.4.2_12-b03.
We have attached a schema and instance document that uses
substitution groups.
We successfully generate Castor classes with the following command:
java -cp xerces-J_1.4.0.jar;commons-logging-1.1.jar;castor-1.1.1-xml.jar;cast or -1.1.1-codegen.jar org.exolab.castor.builder.SourceGeneratorMain -i EasyPo.xsd -package po
However, when we try to unmarshall the attached xml we get Castor Exceptions:
unable to find FieldDescriptor for 'book' in ClassDescriptor of invoice-header
{F ile: [not available]; line: 29; column: 20} For some reason, Castor doesn't like 'book' - however, if book is
replaced by product - everything works fine. However, that is
invalid xml (product is abstract). In fact, ship-comment has the
same problem. It would appear that the substitution groups are not
being Castorized properly, or perhaps we're doing something wrong?
PurchaseOrder vcList = new PurchaseOrder();
try
{ Unmarshaller unmar = new Unmarshaller(PurchaseOrder.class); vcList = (PurchaseOrder) unmar.unmarshal( new InputSource( new StringReader( xmlBuf.toString() ) ) ); }catch (Exception e)
{ ... } Compile: javac -classpath .\castor-1.1.1-xml.jar SendXMLFile.java
Run: java -classpath .\castor-1.1.1-xml.jar SendXMLFile
We have set the automaticConflictResolution=true and left
automaticConflictResolutionTypeSuffix=By.
We still have the same problems.
I think I have identified two areas within Castor that need a cleanup. I think I should be able to come up with a small work-around by tomorrow, hoping that this is actually possible for you, and have a final solution ready within a few days. The problems are related to namespace use (oddly enough, as the test case I have been using during development are fairly complicated), and the sequence order validation in the context of substitution groups.