Nicolas Pujol wrote:
> Hi,
>
> I was wondering if you had an example of the xjc:dom
> instruction used in a .xjb file instead of embedded in
> a schema.
>
> I unsuccessfully tried this:
>
> <jxb:bindings node="//xs:complexType[@name='t_form']">
> <jxb:bindings node=".//xs:sequence">
> <xjc:dom/>
> </jxb:bindings>
> </jxb:bindings>
>
> for this schema
>
> <xs:complexType name="t_form" mixed="true">
> <xs:sequence>
> <xs:any processContents="skip" maxOccurs="unbounded"/>
> </xs:sequence>
> <xs:attribute name="formid" type="xs:ID"
> use="required"/>
> </xs:complexType>
Here's binding example:
<jaxb:bindings xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
version="1.0">
<jaxb:bindings schemaLocation="../schema/schema.xsd" node="/xsd:schema">
<jaxb:bindings
node="//xsd:complexType[@name='RootType']//xsd:element[@name='contents']">
<xjc:dom/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
For this schema:
<xsd:schema
targetNamespace="urn:test"
xmlns:test="urn:test"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:version="1.0"
jaxb:extensionBindingPrefixes="xjc">
<xsd:element name="root" type="test:RootType"/>
<xsd:complexType name="RootType">
<xsd:sequence>
<xsd:element name="content">
<xsd:annotation>
<xsd:appinfo>
<xjc:dom/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="contents" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Bye.
/lexi