In regards to CDATA handling, in XMLBeans < 2.3 there is no way to
influence the algorithm that XMLBeans uses to decide when to put a CDATA
in the output document and when not to (please note, that from the XML
Infoset point of view, use of CDATA section is not relevant as far as
the content of the document, so <Key><![CDATA[ABCDE12345]]></Key> is
equivalent to <Key>ABCDE12345</Key>).

In XMLBeans 2.3 there are some limited ways to influence when CDATA
sections get used, the relevant XmlOptions are
"setSaveCDataLengthThreshold" and "setSaveCDataEntityCountThreshold".
These XmlOptions must be used when saving the document
(node.xmlText(options)).

In XMLBeans > 2.3 there is a better way to control CDATA sections usage,
if you have access to the SVN source, see XmlOptions
"setUseCDataBookmarks" (this option must be used on newInstance, like
you suspected).

Hope this helps,
Radu

> -----Original Message-----
> From: Bryce Fosdick [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 15, 2008 11:49 AM
> To: user@xmlbeans.apache.org
> Subject: CDATA Example
> 
> I am needing to create a CDATA element, but I am having no 
> luck and I can't find a good example.
> 
> The contents will always be 10 characters, padded with right 
> spaces if needed.
> 
> Here is an example of what needs to be created:
>  <Key><![CDATA[ABCDE12345]]></Key>
> 
> Here is the path I was heading down:
> XmlOptions options = new XmlOptions();
> ... (I'm not sure what these should be)
> XmlString xml = XmlString.Factory.newInstance(options);
>  xml.setStringValue("ABCDE12345");
> node.setKey(xml.getStringValue());
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to