The TypeType class has everything you need inside.

TypeType type = TypeType.Factory.newValue(TypeType.ARTIFICIAL_PLANTS);
xmlObject1.set(type);

>From looking at your schema I would say that TypeType is supposed to be
used for "propertyValue" and I can't figure out what to use for
"propertyName". It's difficult to see how the Schema author wants the
Schema to be used because he/she doesn't provide enough information.

Radu

On Wed, 2008-05-07 at 10:56 -0700, John Gan wrote:
> Hi all,
> 
> Thanks Jacob for the help but I'm still not sure what the code will
> look
> like. So far from your suggestions I have the following code but
> stuck. The
> xsd was given to me and I can not change it, probably because there
> are
> other "properties" besides "TypeType" in the xsd.
> 
> com.neweggmall.XMLSchema.HomeLiving.ItemDataFeedDocument.ItemDataFeed.Items.
> Item.ItemProperties.Property prop = itemProperties.addNewProperty();
> 
> XmlObject xmlObject1 = prop.addNewPropertyName();
> 
> XmlObject xmlObject2 = prop.addNewPropertyValue();
> 
> com.neweggmall.XMLSchema.HomeLiving.TypeType type =
> com.neweggmall.XMLSchema.HomeLiving.TypeType.Factory.newInstance();
> 
> /*I'm guessing the TypeType object is the "property name" element? I
> don't
> see any xset() method but there is a set() method. But when I printed
> the
> xml document with only setting "xmlObject1.set(type)" just to see if a
> "property" element is printed I don't see any "property" element?*/
> 
> xmlObject1.set(type);
> 
> //Still not sure what to do about the "property value"?
> 
> xmlObject1.set(??????);
> 
> Also, is there any use for the generated enums in the TypeType class
> like:
> "com.mysite.XMLSchema.HomeLiving.TypeType.ARTIFICIAL_PLANTS" ?
> 
> Thanks in advance,
> John
> 
> -----Original Message-----
> From: Jacob Danner [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 06, 2008 7:16 PM
> To: user@xmlbeans.apache.org; [EMAIL PROTECTED]
> Subject: Re: Adding a "xs:simpleType" to the xml document
> 
> 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]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

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

Reply via email to