xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murphy, Eric" <erimu...@pfc.cfs.nrcan.gc.ca>
Subject RE: Xpath and shema element declarations
Date Fri, 02 Jul 2004 15:40:43 GMT
Eric -

Thanks. No my xml was not valid. I was not (and maybe still am not) aware of
how the elements are declared in the schema affect how they must be
qualified in the xml document.

In the case where the form of the xml document was correct but the namespace
declaration was not(thus making the document invalid), I was returned the
array of XmlAnyTypeImpl objects.  I suppose the typing information was not
known due to the namespace problem. 

The xml namespace declarations need to be handled differently depending on
how I declare the elements in the schema. I was using the same xml document
that was valid for one type of declaration of the elements and not the
other.  

Thanks for your reply it has been helpful.

Eric Murphy

-----Original Message-----
From: Eric Vasilik [mailto:ericvas@bea.com] 
Sent: Wednesday, June 30, 2004 4:05 PM
To: xmlbeans-user@xml.apache.org
Subject: RE: Xpath and shema element declarations

The selectPath method does not depend on the schema.  It simply performs a
selection and returns an array of XmlObject from the elements and attributes
selected.

Your issue seems to be one of chema.  Try using an XmlCursor to peruse your
instance, calling getObject at the elements and attrs to see what type they
are.  Is your instance valid with respect to your schema?

- Eric

> -----Original Message-----
> From: Murphy, Eric [mailto:erimurph@pfc.cfs.nrcan.gc.ca]
> Sent: Wednesday, June 30, 2004 3:50 PM
> To: xmlbeans-user@xml.apache.org
> Subject: 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/


- ---------------------------------------------------------------------
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/

- ---------------------------------------------------------------------
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/


Mime
View raw message