XMLBean Document Objects
Duane Zamrok <[email protected]> Thu, 27 May 2010 14:25:42 -0400
| Newsgroups | gmane.text.xml.xmlbeans.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm working with an XML schema that defines a complex type but not an element of that type. This means that when I compile the schema with XMLBeans I get FooType.java but not a FooDocument.java. However, I'd like to be able to parse documents whose root element has been defined to be of type Foo. Is this possible with XMLBeans or should I simply pursue a manual parsing alternative?
Example Schema
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:org:test:namespace" elementFormDefault="qualified">
<xs:complexType name="FooType">
<xs:sequence>
<xs:element name="bar" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Example Document
<someElementName xmlns:tst="urn:org:test:namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="tst:FooType">
<tst:bar>some value</tst:bar>
</someElementName>
Thanks
-Duane