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 & Accent"/>
<xs:enumeration value="Runners"/>
<xs:enumeration value="Doormats"/>
<xs:enumeration value="Rug sets"/>
<xs:enumeration value="Rug Underlays, Pads & Grips"/>
<xs:enumeration value="Tatami & 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