Hi Pavel

 

The content model you are referring to is called a “mixed” content model. You specify this in your schema using the mixed=”true” attribute: either

 

<complexType … mixed=”true” >

 …

</complexType>

 

Or

 

<complexType>

  <complexContent mixed=”true”>

    …

  </complexContent>

</complexType>

 

See the schema spec (http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions) for details.

 

If you use XmlBeans on a schema like that then we do not generate a gettter/setter for the text which may (or may not) be inside the element in the instance doc. Instead you use the XmlCursor APIs. Once you have an XmlObject (xmlo) do something like this:

 

XmlCursor c = xmlo.newCursor();

c.toFirstContentToken();

String s = c.getTextValue();

c.dispose();

 

The following links may also be useful to you:

 

http://xmlbeans.apache.org/documentation/tutorial_getstarted.html (the part labelled “Getting Started with the XML Cursor” near the bottom)

http://xmlbeans.apache.org/docs/2.0.0/guide/conNavigatingXMLwithCursors.html

http://dev2dev.bea.com/pub/a/2003/11/traut.html

 

Cheers,

 

Lawrence

 


From: Pavel Krupets [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 26, 2006 2:12 AM
To: [email protected]
Subject: Help needed with mixed content...

 

Hello,

 

I need to implement something like this:

 

<attribute name=”…” class=”…”>

  <attribute name=”…”>value</attribute>

  <attribute name=”…”>value</attribute>

/attribute>

 

and

 

<attribute name=”…”>value</attribute>

 

What I mean is that attribute element can contain sub elements OR text. What do I need to use to implement this? Note that I need to read document (it will be typed manually by user).

 

With regards,

Pavel Krupets

_______________________________________________________________________
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.

Reply via email to