Hi Sanjeeva

My guess is you're running into the "formal" type versus "convenience"
type issue (see some of the original design docs for XmlBeans by David
Bau - e.g.
http://davidbau.com/archives/2003/11/14/the_design_of_xmlbeans_part_1.ht
ml).

For convenience SLType would just be a String, but because we need to
inherit from it we need a type that can be inherited from. In XmlBeans
we use the formal type XmlString for this.

So I imagine the answer to your question is that Location inherits from
XmlString (which inherits from XmlAnySimpleType) and as a consequence
you should use the getStringValue() method on your Location object to
get the value you want.

Cheers,

Lawrence

> -----Original Message-----
> From: Sanjeeva Kumar [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 13, 2005 10:35 PM
> To: dev@xmlbeans.apache.org
> Subject: accessing derivedBy exension element values
> 
> Hi,
> 
> I have the following schema
> ==============
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>       <!--    <xs:simpleType name="SLType">
>               <xs:restriction base="xs:string">
>                       <xs:maxLength value="255"/>
>                       <xs:minLength value="0"/>
>               </xs:restriction>
>       </xs:simpleType>
>       <xs:simpleType name="upType">
>               <xs:restriction base="xs:string">
>                       <xs:enumeration value="update"/>
>               </xs:restriction>
>       </xs:simpleType>
>       <xs:element name="Root">
>               <xs:annotation>
>                       <xs:documentation>Comment describing your root
> element</xs:documentation>
>               </xs:annotation>
>               <xs:complexType>
>                       <xs:sequence>
> 
>                               <xs:element name="location"
minOccurs="0">
>                                       <xs:complexType>
>                                               <xs:simpleContent>
>                                                       <xs:extension
base="SLType">
>
<xs:attribute
> name="modifier" type="upType"/>
>                                                       </xs:extension>
>                                               </xs:simpleContent>
> 
>                                       </xs:complexType>
>                               </xs:element>
> 
> 
>                       </xs:sequence>
>               </xs:complexType>
>       </xs:element>
> <xs:schema>
> ===============
> 
> Using xmlBeans (scomp) i generated the jar file. With
> the following sample xml file i am trying to get the
> value
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Root
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> 
> 
> xsi:noNamespaceSchemaLocation="D:\temp\testschema\testschema.xsd">
>                               <location
> modifier="update">Gaithersburg</location>
> </Root>
> 
> 
> 
> How can i access the value "Gaithersburg". Code
> snippet is as follows
> 
>       RootDocument rtd =
> RootDocument.Factory.parse(xmlstring);
>       Root rt = rtd.getRoot();
> 
>         Location lo = rt.getLocation();
> 
> In the Location i am not getting the values. It just
> gives the modifier i have. Please let me know how to
> access the value in case of derivedBy extension.
> 
> Thanks in advance.
> 
> -San
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to