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;castor-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

Has anyone been able to get substitution groups working?

Thanks,


Attachment: EasyPo.xsd
Description: Binary data

Attachment: Purchase-Order.xml
Description: Binary data

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to