You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Gene Holmerud <ge...@cox.net> on 2005/06/09 19:30:37 UTC
Created accessor/mutator methods for attributes
Vaguely related to: How to limit the range of the integer type
I noticed his compile created a "get" method for his attribute value. My
compiles, instead, yield only methods such as get/setYTDRENTArray. This,
in turn, gives me strings of XML snippits that look like "<xml-fragment
year="1990">4200</xml-fragment>" rathar than the values "1990" and/or
"4200".
I used getMethod(Reflection) to see what methods are generated as well a
scaning the generated source. Is there a way to get/set the values
directly?
My .xml file is structured as (excerpted for readability):
...
<HOUSES xmlns="http://HOUSES">
<HOUSE>
--some other (non-repeating) elements--
<YTD_RENT year="1990">4200</YTD_RENT>
--about 15 more of the above thru year="2005"--
</HOUSE>
--repeats of other houses--
</HOUSES>
My schema (full copy attached) is structured:
<xs:schema ...
<xs:element name="HOUSES">
<xs:complexType>
<xs:sequence>
<xs:element name="HOUSE" type="hse:houseElement"
minOccurs="8"
maxOccurs="8"/>
</xs:sequence>
...
<xs:complexType name="houseElement">
<xs:sequence>
--the non-rpeating elements as type="xs:string"---
<xs:element name="YTD_RENT" type="yr:ytdRentElement"
minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ytdRentElement">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="year" type="xs:ID"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
Gene
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Created accessor/mutator methods for attributes
Posted by Gene Holmerud <ge...@cox.net>.
> Vaguely related to: How to limit the range of the integer type
>
> I noticed his compile created a "get" method for his attribute value.
> My compiles, instead, yield only methods such as get/setYTDRENTArray.
> This, in turn, gives me strings of XML snippits that look like
> "<xml-fragment year="1990">4200</xml-fragment>" rathar than the values
> "1990" and/or "4200".
>
> I used getMethod(Reflection) to see what methods are generated as well a
> scaning the generated source. Is there a way to get/set the values
> directly?
>
> My .xml file is structured as (excerpted for readability):
> ...
> <HOUSES xmlns="http://HOUSES">
> <HOUSE>
> --some other (non-repeating) elements--
> <YTD_RENT year="1990">4200</YTD_RENT>
> --about 15 more of the above thru year="2005"--
> </HOUSE>
> --repeats of other houses--
> </HOUSES>
>
> My schema (full copy attached) is structured:
>
> <xs:schema ...
> <xs:element name="HOUSES">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="HOUSE" type="hse:houseElement"
> minOccurs="8" maxOccurs="8"/>
> </xs:sequence>
> ...
> <xs:complexType name="houseElement">
> <xs:sequence>
> --the non-rpeating elements as type="xs:string"---
> <xs:element name="YTD_RENT" type="yr:ytdRentElement"
> minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="ytdRentElement">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="year" type="xs:ID"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:schema>
>
> Gene
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/