You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Fa...@Lawson.com on 2004/09/28 18:07:46 UTC
problems marshalling xml schema with any element
All,
I have a schema which has the any tag in it as follows:
<xsd:complexType name="BodyType">
<xsd:sequence>
<xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
However when I try to marshall an xml document from this schema I am
unable to add the body element to the document.
For example, I am trying to create a doc which looks like:
<example>
<testing>
<name>Mee</name>
<password>pass</password>
</testing>
<body>
<command>
----some command elements
</command>
<body>
<example>
Because the body has a schema definition as above there are no get or set
methods for adding command to body. Can anybody advise how I would go
about adding command to the body tag. If I use the XMLCursor then do I
have to create the remainder of the document using the XMLCursor methods
i.e insertElement etc...?
Is there anyway that I can create the first element body using XMLCursor
like:
XmlCursor cur = body.newCursor();
cur.beginElement("command");
and then add the command into the cursor although the cursor has no method
to do this or i could not see an appropriate one
Thanks for your help