Hi John,
If you have specify properties (ie, Type_Type) why isn't the type
attribute set in your schema element?
instead of:
<xs:element name="PropertyName"/>
try
<xs:element name="PropertyName" type="Type_Type"/>

This will let you have specific methods for setting those enumeration values.

I think your schema might need a little tweaking to make it more usable.

If thats not an option, you are going to need to construct the type
(Type_Type) and then set the value using one of the set or xset
methods.

HTH,
-jacobd


On Tue, May 6, 2008 at 5:05 PM, John Gan <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi all,
>
>
>
> I'm having trouble adding a new element to the xml document.
>
>
>
> Here is the xsd snippet which represents some properties in my schema:
>
>
>
> <xs:element name="ItemProperties" minOccurs="0">
>
>             <xs:complexType>
>
>                         <xs:sequence minOccurs="0" maxOccurs="unbounded">
>
>                                     <xs:element name="Property">
>
>                                                 <xs:complexType>
>
>                                                             <xs:sequence>
>
>
> <!--please refer to simpeType name-->
>
>
> <xs:element name="PropertyName"/>
>
>
> <!--please refer to enumeration list in simpeType-->
>
>
> <xs:element name="PropertyValue"/>
>
>                                                             </xs:sequence>
>
>                                                 </xs:complexType>
>
>                                     </xs:element>
>
>                         </xs:sequence>
>
>             </xs:complexType>
>
> </xs:element>
>
>
>
> Somewhere else in the xsd the following snippet is one of many properties
> enumerations:
>
>
>
> <xs:simpleType name="Type_Type">
>
>   <xs:restriction base="xs:string">
>
>    <xs:enumeration value="Area &amp; Accent"/>
>
>    <xs:enumeration value="Runners"/>
>
>    <xs:enumeration value="Doormats"/>
>
>    <xs:enumeration value="Rug sets"/>
>
>    <xs:enumeration value="Rug Underlays, Pads &amp; Grips"/>
>
>    <xs:enumeration value="Tatami &amp; Non-cloth"/>
>
>    <xs:enumeration value="Artificial Flowers"/>
>
>    <xs:enumeration value="Artificial Fruits"/>
>
>    <xs:enumeration value="Artificial Grasses"/>
>
>    <xs:enumeration value="Artificial Mixed Floral Arrangements"/>
>
>    <xs:enumeration value="Artificial Plants"/>
>
>    <xs:enumeration value="Artificial Shrubs"/>
>
>    <xs:enumeration value="Artificial Topiaries"/>
>
>    <xs:enumeration value="Artificial Trees"/>
>
>    <xs:enumeration value="Artificial Vegetables"/>
>
>   </xs:restriction>
>
>  </xs:simpleType>
>
>
>
> Looking at the source code for the generated xmlbean classes, I wrote the
> following code to add a new property to the document:
>
>
>
> com.mysite.XMLSchema.HomeLiving.ItemDataFeedDocument.ItemDataFeed.Items.Item.ItemProperties
> itemProperties = item.addNewItemProperties();
>
>
>
> com.mysite.XMLSchema.HomeLiving.ItemDataFeedDocument.ItemDataFeed.Items.Item.ItemProperties.Property
> prop = itemProperties.addNewProperty();
>
>
>
> XmlObject xmlObject1 = prop.addNewPropertyName();
>
> XmlObject xmlObject2 = prop.addNewPropertyValue();
>
>
>
> The method prop.addNewPropertyName() and prop.addNewPropertyValue() returns
> an XmlObject? How do I set the property name and value? I'm still new to
> XMlBeans and from what I read the XmlObject class is the super class of all
> elements in an xmlbean document (basically a blank element without name,
> attribute, or value)? But how do I set the name, value, or attribute to a
> blank XmlObject? Looking over the methods in XmlObject I don't see anything
> that will do that.
>
>
>
> Any help is greatly appreciated,
>
> John
>
>
>
>
>
>
>
>
>
>



-- 
I'm competing in a Half-Ironman distance triathlon to raise money for
the fight against cancer!
Please help support my efforts by going to:
http://www.active.com/donate/tntwaak/jacobd

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

Reply via email to