Hi.
> Thanks for the reply. I couldn't find anything about DOM annotation in
> JAXB tutorial/docs. Would you be able to provide an example or point me
> to some documentation?
Don't have a link handy. Here's an example from Hyperjaxb tests:
<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>
Results in:
//
// This file was generated by the JavaTM Architecture for XML
Binding(JAXB) Reference Implementation, v1.0.4-b16-fcs
// See <a
href="
http://java.sun.com/xml/jaxb">
http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the
source schema.
// Generated on: 2005.03.23 at 04:29:54 CET
//
package test;
/**
* Java content class for RootType complex type.
* <p>The following schema fragment specifies the expected content
contained within this java content object. (defined at
file:/C:/Projects/dev.java.net/hyperjaxb/tests/dom/schema/schema.xsd
line 18)
* <p>
* <pre>
* <complexType name="RootType">
* <complexContent>
* <restriction base="{
http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="content"
type="{
http://www.w3.org/2001/XMLSchema}anyType"/>
* <element name="contents"
type="{
http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*/
public interface RootType {
/**
* Gets the value of the Contents property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the
Contents property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getContents().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {_at_link org.w3c.dom.Element}
*
*/
java.util.List getContents();
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {_at_link org.w3c.dom.Element}
*/
org.w3c.dom.Element getContent();
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {_at_link org.w3c.dom.Element}
*/
void setContent(org.w3c.dom.Element value);
/**
* Gets the value of the Contents property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the
Contents property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getContents().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {_at_link org.w3c.dom.Element}
*
*/
public java.util.List getContentsInternal();
public void setContentsInternal(java.util.List theContentsInternal);
/**
*
*/
public java.lang.String getIdInternal();
public void setIdInternal(java.lang.String anId);
}
Bye.
/lexi