|
The reason that you see setStringValue()/getStringValue()
on some of the generated classes but not on others is the difference between
simple content and mixed content.
Simple content means that an element can only have text as
contents, while mixed content means that it can have both text and elements.
When the type has simple content, then you get the get/setStringValue() and you
can manipulate the text as a whole, however when the type has mixed content
(which most of the types in xhtml have), then you can't get the text as a whole,
but you need to know where children element were present relative to
text children. Example: you need to extract all the text from a <p> tag,
independent of formatting. In this case you want to get the text that is an
immediate child of <p>, but if you find a <b> tag as a child, you
need to get its text too and you want this text to show up in the right
order.
This is why mixed content is accessed using XmlCursor, for
an example of how to do it, see http://xmlbeans.apache.org/samples/MixedContent.html
Radu From: Orville Pike [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 17, 2006 10:21 AM To: [email protected] Subject: XMLBeans and XHTML Hi All, I’ working on some code to parse and generate XHTML.
What I’ve done is used scomp to generate the XMLBeans classes from
xhtml1-strict.xsd. This all works and I can at the moment generate valid xhtml
however I cannot figure out how to set content data ie, how do I set and get
“Example URL” out of the following <a href=""
Url</a> The setting code is like this: ADocument.A a = null; a = td.addNewA(); a.setHref("http://example.com"); a.setStyle("mystyle"); What I was expecting was some generic function such as
setStringValue()/getStringValue() but not of the xhtml classes I generated
have this. To test this I generated my own set of classes from my own xsd
and some items do have a setStringValue()/getStringValue() which is not
deprecated and when used returns me the data I expect. I’m using XMLBeans 2.2.0 with JDK 1.5.0 My scomp command: scomp -noann -noupa -out xhtml1-strict.jar
-compiler \jdk1.5.0_07\bin\javac.exe xhtml1-strict.xsd Any ideas _______________________________________________________________________ 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. |
- XMLBeans and XHTML Orville Pike
- RE: XMLBeans and XHTML Radu Preotiuc-Pietro

