Hi Argyn insertChars() and setTextValue() treat their arguments as text i.e. not as structured XML elements. You need the insertElement() or beginElement() APIs on the XmlCursor. See http://xmlbeans.apache.org/docs/2.0.0/guide/conNavigatingXMLwithCursors. html for more details.
Cheers, Lawrence > -----Original Message----- > From: argyn [mailto:[EMAIL PROTECTED] > Sent: Monday, June 20, 2005 5:29 PM > To: [email protected] > Subject: insert foreign schema element > > I have a "my-schema" with one of the element defined like this: > ======= > <xs:element name="Content" type="ContentType"/> > <xs:complexType name="ContentType" mixed="true"> > <xs:sequence> > <xs:any namespace="##any" processContents="lax" > minOccurs="0" maxOccurs="unbounded"/> > </xs:sequence> > <xs:anyAttribute namespace="##any" processContents="lax"/> > </xs:complexType> > ======= > The idea is that Content element can contain any elements from other > schemas, or simply some text or data. > > here's a xml fragment of the document: > ======= > <?xml version="1.0" encoding="UTF-8"?> > <Request > xmlns="my-schema" > xmlns:md="foreign-schema" > > > > ...[skip this]... > > <Content> > <md:record> > <md:patient_info> > <md:name>XYZ</md:name> > <md:age>60</md:age> > <md:sex>male</md:sex> > <md:health_insurance>123456</md:health_insurance> > </md:patient_info> > </md:record> > </Content> > ======= > > I'm having trouble constructing this document. If I use > cursor.insertChars() or setTextValue() then the document looks like this: > > ======= > <Content><![CDATA[<md:record> > <md:patient_info> > <md:name>XYZ</md:name> > <md:age>60</md:age> > <md:sex>male</md:sex> > --- etc > ======= > > i.e. XmlBeans adds <![CDATA[. How to insert the foreign elements into > the XML with XMLBeans? > > thanks, > argyn > > > --------------------------------------------------------------------- > 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]

