You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Weiler, Frank (KBV)" <FW...@KBV.DE> on 2005/06/02 08:01:26 UTC
under which circumstances schema compiler creates a Document class ?
Hello !
I would like to know, for which XML Schema constructs the schema compiler creates a Document class for a element or type defined in the schema ?
I have a complex XML schema, which constists of multiple xsd-files, the schema makes extensive use of namespaces and type inheritance (mostly types are derived by restriction).
In my application I have to parse xml fragments, and if I try to parse the fragment with the appropriate type class, the child elements are not set. If I use the appropriate Document class, all works fine. But there is no Document class for all schema types or elements.
Example (schema fragment only):
<xs:element name="header" type="vdx_header_typ"/>
<xs:complexType name="vdx_header_typ">
<xs:complexContent>
<xs:restriction base="ehd_header_typ">
<xs:sequence>
<xs:element ref="id"/>
<xs:element name="document_type_cd" type="vdx_document_type_cd_typ"/>
<xs:element ref="service_tmr"/>
<xs:element name="origination_dttm" type="origination_dttm_typ"/>
<xs:element name="provider" type="provider_typ" maxOccurs="unbounded"/>
<xs:element name="interface" type="vdx_interface_typ"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
The schema compiler creates two classes: HeaderDocument.java and VdxHeaderTyp.java
A call to
VdxHeaderTyp head = VdxHeaderTyp.Factory.parse(xmltext);
let all childs unset (null), f.e.
head.getId() returns null.
A call to
HeaderDocument head = HeaderDocument.Factory.parse(xmltext)
works and I can get the id child with head.getId()
So, what's the problem ?
Regards, Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org