You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Murphy, Eric" <er...@pfc.cfs.nrcan.gc.ca> on 2004/07/01 00:50:02 UTC
Xpath and shema element declarations
XmlBeans -
XmlObject.selectPath(query) returns an array of XmlAnyTypeImpl
when the schema is created with anonymous complex types. These objects
cannot be cast into the object I want.
If in my schema I declare:
<element type="xbeans:top_element" name="top_element"/>
<complexType name="top_element">
<sequence>
<element type="xbeans:second_level" name="second_level" maxOccurs="3"
minOccurs="1"/>
</sequence>
<attribute name="top_attr" type="string" use="required"/>
</complexType>
when using select path I will be returned an array of type TopElements. This
is what I want.
However if I declare (or worse if someone else declares) top element this
way:
<element name="top_element">
<complexType>
<sequence>
<element type="xbeans:second_level" name="second_level"
maxOccurs="3" minOccurs="1"/>
</sequence>
<attribute name="top_attr" type="string" use="required"/>
</complexType>
</element>
and I use selectPath(query) I will be returned an array of XmlAnyTypeImpl.
There
does not seem to be a way to turn any of these objects into the type I want.
Does selectPath(String) depend on the schema being created a particular way
to function?
Eric Murphy
Software Developer (NFIS)
erimurph@pfc.forestry.ca
tel/tél: 250-363-6038
fax / télécopieur 250-363-6004
Natural Resources Canada
Pacific Forestry Centre
506 West Burnside Road
Victoria BC V8Z 1M5
Ressources naturelles Canada
Centre de foresterie du Pacifique
506 rue Burnside ouest
Victoria, Colombie-Britanique V8Z 1M5
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/