You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Brian Deep <bd...@cc-sw.com> on 2004/10/11 17:27:27 UTC

Re[2]: Schema Parsing

Hmm, I guess I should have been more specific, as I know what to do once I get
the schemaType.  My questions is how do I get the schemaType in the first
place?

Given this type as part of the xsd:
<xs:complexType name="Car">
     <xs:attribute name="Owner" type="xs:string"/>
     <xs: attribute name="Make"/>
         <xs:simpleType>
             <xs:restriction base="xs:NMTOKEN">
                 <xs:enumeration value="GM"/>
                 <xs:enumeration value="Ford"/>
                 <xs:enumeration value="Chrysler"/>
                 <xs:enumeration value="Toyota"/>
             </xs:restriction>
          </xs:simpleType>
    </xs:attribute>
</xs:complexType>

Xmlbeans will create a class CarType(Impl) and within CarType(Impl) will create
a class Make(Impl).  How do I get a reference to the Make(Impl) schema
definition given only the string "Make" or the string "Car.Make"?

I am basically creating an interface using token strings of the xsd to only
display screens that I need the user to define.   So, later
on, there will be queries to get the model and year of the car.

Thanks,
-- Brian


Friday, October 8, 2004, 5:20:13 PM, you wrote:
> I think you'll need org.apache.xmlbeans.SchemaType.  In your example:

> XmlAnySimpleType[] array =
> element.xgetCarmake().type.getEnumerationValues() ; 
> Should give you all the enum values. 


> -Rashmi



> On Fri, 8 Oct 2004 14:06:33 -0400, Brian Deep <bd...@cc-sw.com> wrote:
>> Given an attribute name, I need to find the schema type to determine whether or
>> not the given type has any restrictions.  Can anyone recommend where to start or
>> how to go about getting this?
>> 
>> e.g.
>> 
>> Given this attribute as part of the xsd:
>> <xs:attribute name="CarMake">
>>     <xs:simpleType>
>>         <xs:restriction base="xs:NMTOKEN">
>>             <xs:enumeration value="GM"/>
>>             <xs:enumeration value="Ford"/>
>>             <xs:enumeration value="Chrysler"/>
>>             <xs:enumeration value="Toyota"/>
>>         </xs:restriction>
>>      </xs:simpleType>
>> </xs:attribute>
>> 
>> and given the string "CarMake", how can I pull the restrictions out of the xsd
>> if it is implemented using xmlbeans?
>> 
>> Thanks,
>> -- Brian
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>> 
>>

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Re[2]: Schema Parsing

Posted by Rashmi Banthia <rj...@gmail.com>.
Hello,

If you check the generated source code every generated class has 
"public static final org.apache.xmlbeans.SchemaType type". 

So in your case "carelement.xgetMake().type" gives reference to the schemaType.

Once you have schemaType you can get all the information related to XSD. 

Hope this helps.

-Rashmi 


On Mon, 11 Oct 2004 11:27:27 -0400, Brian Deep <bd...@cc-sw.com> wrote:
> Hmm, I guess I should have been more specific, as I know what to do once I get
> the schemaType.  My questions is how do I get the schemaType in the first
> place?
> 
> Given this type as part of the xsd:
> <xs:complexType name="Car">
>      <xs:attribute name="Owner" type="xs:string"/>
>      <xs: attribute name="Make"/>
>          <xs:simpleType>
>              <xs:restriction base="xs:NMTOKEN">
>                  <xs:enumeration value="GM"/>
>                  <xs:enumeration value="Ford"/>
>                  <xs:enumeration value="Chrysler"/>
>                  <xs:enumeration value="Toyota"/>
>              </xs:restriction>
>           </xs:simpleType>
>     </xs:attribute>
> </xs:complexType>
> 
> Xmlbeans will create a class CarType(Impl) and within CarType(Impl) will create
> a class Make(Impl).  How do I get a reference to the Make(Impl) schema
> definition given only the string "Make" or the string "Car.Make"?
> 
> I am basically creating an interface using token strings of the xsd to only
> display screens that I need the user to define.   So, later
> on, there will be queries to get the model and year of the car.
> 
> Thanks,
> -- Brian
> 
> 
> 
> 
> Friday, October 8, 2004, 5:20:13 PM, you wrote:
> > I think you'll need org.apache.xmlbeans.SchemaType.  In your example:
> 
> > XmlAnySimpleType[] array =
> > element.xgetCarmake().type.getEnumerationValues() ;
> > Should give you all the enum values.
> 
> > -Rashmi
> 
> > On Fri, 8 Oct 2004 14:06:33 -0400, Brian Deep <bd...@cc-sw.com> wrote:
> >> Given an attribute name, I need to find the schema type to determine whether or
> >> not the given type has any restrictions.  Can anyone recommend where to start or
> >> how to go about getting this?
> >>
> >> e.g.
> >>
> >> Given this attribute as part of the xsd:
> >> <xs:attribute name="CarMake">
> >>     <xs:simpleType>
> >>         <xs:restriction base="xs:NMTOKEN">
> >>             <xs:enumeration value="GM"/>
> >>             <xs:enumeration value="Ford"/>
> >>             <xs:enumeration value="Chrysler"/>
> >>             <xs:enumeration value="Toyota"/>
> >>         </xs:restriction>
> >>      </xs:simpleType>
> >> </xs:attribute>
> >>
> >> and given the string "CarMake", how can I pull the restrictions out of the xsd
> >> if it is implemented using xmlbeans?
> >>
> >> Thanks,
> >> -- Brian
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> >> For additional commands, e-mail: user-help@xmlbeans.apache.org
> >>
> >>
> 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org