|
I’m not an expert in JAXB but here
it is my take on it: 1) When compiling with XMLBeans the schema files, one can customize
the package names and the class names through .xsdconfig file, but it doesn’t
allow changing the property name. If you really care about the property name you
can use Interface Extensions and delegate to the real method (go here for more
details: http://wiki.apache.org/xmlbeans/ExtensionInterfacesFeature
) 2) XMLBeans always generates isSet methods. 3) For properties that have maxOccurs bigger than 1, XMLBeans
generates the following setters and getters:
4) XMLBeans always generates type-safe Enumeration like types for
schema enumeration types. 5) I don’t understand exactly the problem here, but it seems to
me that it should at least be solvable using the Interface Extension. And
through the type variable on every generated type you can get to _all_ of the XML info set information on
that and other types including any default/fixed values etc. 6) XMLBeans will automatically generate a type for schema type
CustomDate that will allow one to play with instances of that type. Also one
can verify the validity of an instance of this type at any time and can have access
to the raw string. Specifically for dates, XMLBeans contains classes that
follow exactly the semantics of XMLSchema date types. I hope this helps, Cezar, Radu, Lawrence From: Jun Victorio
[mailto:[EMAIL PROTECTED] Hi there, I’m new in using xmlbeans and xml schema. We are
trying to migrate an existing application that uses jaxb to xmlbeans. The
current application uses jaxb 1.6 version. I have several questions regarding
specific jaxb custom binding extensions that are used and try converting this
to xmlbeans standard.
<xsd:element name="AvailabilityResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ResponseItem" minOccurs="0"
maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<jxb:property
name="responseItems"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element> How would you define this is
xmlbeans schema format. Since I can not use the “jxb:property name=…”
<xsd:element name="Day" type="xsd:date"
minOccurs="0">
<xsd:annotation>
<xsd:appinfo>
<jxb:property
generateIsSetMethod="true"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
Is there any corresponding xmlbeans extension for “jxb:property generateIsSetMethod=”true”/>”
or attributes?
<xsd:element
name="BrandID" type="xsd:int" minOccurs="0"
maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<jxb:property name="brandIDs"
collectionType="indexed"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
Again is there any corresponding xmlbeans extension for: “<jxb:property name="brandIDs"
collectionType="indexed"/>”
<xsd:simpleType name="PartNumberConstants">
<xsd:annotation>
<xsd:appinfo>
<jxb:typesafeEnumClass/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="INTERNAL"/>
<xsd:enumeration value="SKU"/>
<xsd:enumeration value="UPC"/>
</xsd:restriction>
</xsd:simpleType>
What’s the correponding xmlbeans extensions for: “<jxb:typesafeEnumClass/>” or
is xmlbeans already has type safe enumeration build-in when you define an
enumeration?
<xsd:annotation>
<xsd:appinfo>
<jxb:globalBindings
fixedAttributeAsConstantProperty="true"
collectionType="java.util.ArrayList"/>
<jxb:schemaBindings>
<jxb:package
name="com.starcomsoft.growernetwork.binding.availability"/>
</jxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation> I
don’t understand the meaning of “<jxb:globalBindings
fixedAttributeAsConstantProperty="true"
collectionType="java.util.ArrayList"/>”.
I’ve read the JAXB tutorial and still don’t fully grasp the meaning
of this one. From what I know it looks like when an element is an
enumeration/sets the generated Java classes will return an instance of
ArrayList instead of array[]. Is there any corresponding xmlbean
extension/attributes or custom binding for it?
<xsd:simpleType name="CustomDate">
<xsd:annotation>
<xsd:appinfo>
<jxb:javaType
name="com.starcomsoft.growernetwork.connect.messaging.CustomDate"
parseMethod="fromString" printMethod="toString"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:length value="10"/>
<xsd:pattern value="\d{4}-\d{2}-\d{2}"/>
</xsd:restriction>
</xsd:simpleType> This one jaxb provides a custom
binding for a type “CustomDate” and will call the custom java class
handler to process the data. How would I implement this in xmlbeans? Any help or suggestions are greatly
appreciated and also thank you in advance for all your help. Jun Victorio |
- Help in Converting JAXB schema to XMLBeans schema Jun Victorio
- RE: Help in Converting JAXB schema to XMLBeans schema Cezar Andrei

