You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Jim Ma <ji...@iona.com> on 2007/02/05 07:11:45 UTC
XMLSchema and JAXB binding info
Hi all,
I pass the following schema to XMLSchemaCollection.read(). When I read the
element from XMLSchema,
I found the jaxb binding info is lost.
<element name="MyProcess">
<simpleType>
<annotation>
<appinfo>
<jaxb:typesafeEnumClass name="MyProcess">
<jaxb:typesafeEnumMember name="BLUE" value="BLUE"/>
<jaxb:typesafeEnumMember name="RED" value="RED"/>
<jaxb:typesafeEnumMember name="GREEN" value="GREEN"/>
</jaxb:typesafeEnumClass>
</appinfo>
</annotation>
<restriction base="string">
<enumeration value="BLUE"/>
<enumeration value="RED"/>
<enumeration value="GREEN"/>
</restriction>
</simpleType>
</element>
This is the code I found this issue :
XmlSchema xmlSchema = schemaCol.read(schema);
Document[] docs = xmlSchema.getAllSchemas();
for (int i = 0; i < docs.length; i++) {
Element ele = docs[i].getDocumentElement();
try {
DOMUtils.writeXml(ele, System.out);
} catch (TransformerException e) {
//
}
}
I investigated the xmlSchema code and found XMLSchema does not handle the
non-standard schema element like <jaxb: xxx>.
When tools use the service model to generate code , it can not get the
schemaInfo contains jaxb customization
to generate customized types class.
So we need to get schema element from definition instead of getting the
schema element from xmlshemaCollection.
I will refactor the WSDLServuceBuilder to extract the schema from element
and put the element list in service
model.
Thoughts?
Thanks
Jim