

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
7 messages in org.apache.xmlbeans.userRE: CDATA Example| From | Sent On | Attachments |
|---|---|---|
| Bryce Fosdick | May 15, 2008 11:48 am | |
| Radu Preotiuc-Pietro | May 16, 2008 12:49 pm | |
| Bryce Fosdick | May 19, 2008 2:28 pm | |
| Radu Preotiuc-Pietro | May 20, 2008 2:52 pm | |
| Bryce Fosdick | May 20, 2008 3:34 pm | .dat |
| Radu Preotiuc-Pietro | May 28, 2008 4:33 pm | |
| Bryce Fosdick | Jun 4, 2008 10:38 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | RE: CDATA Example | Actions... |
|---|---|---|
| From: | Radu Preotiuc-Pietro (rad...@bea.com) | |
| Date: | May 28, 2008 4:33:16 pm | |
| List: | org.apache.xmlbeans.user | |
I have played with the new CDATA feature in the upcoming XMLBeans 2.4, and this is how you control CDATA in a new document that you are building:
node.setKey("ABCDE12345"); XmlCursor c = node.xgetKey().newCursor(); c.toFirstContentToken(); c.setBookmark(CDataBookmark.CDATA_BOOKMARK);
Hope this helps, Radu
-----Original Message----- From: Bryce Fosdick [mailto:bryc...@interactivehotelsolutions.com] Sent: Tuesday, May 20, 2008 3:35 PM To: us...@xmlbeans.apache.org Subject: RE: CDATA Example
I understand the purpose of CDATA; I am just unclear on how to use it within XMLBeans. I realize that node.setKey("<![CDATA[ABCDE12345]]>") is not going to work (it was written to be an example of what I am trying to accomplish), because I am not sure how to make it work since key is defined as a string within the complexType node, containing more properties than just key.
-----Original Message----- From: Radu Preotiuc-Pietro [mailto:rad...@bea.com] Sent: Tue 5/20/2008 4:52 PM To: us...@xmlbeans.apache.org Subject: Re: CDATA Example
CDATA is not supposed to work like that. CDATA is an escape mechanism.
Calling node.setKey("<![CDATA[ABCDE12345]]>") is almost certainly not what you want. Call node.setKey("ABCDE12345") instead. But anyway, you need to refer to the XML spec or an XML book to learn more about CDATA first, to avoid some of the frustration...
Radu
On Mon, 2008-05-19 at 14:29 -0700, Bryce Fosdick wrote:
Ok so I downloaded the 2.4 source, and updated everything needed to get it working but I am still having problems using the CDATA.
If I create a Key xmlobject, the setUseCDataBookmarks seems to be working correctly because if I print the xmlText it displays <Key><! [CDATA[ABCDE12345]]></Key>
The problem is I am trying use node.setKey(xml), where xml is the string <! [CDATA[ABCDE12345]]>
Everything I have tried results in: <![CDATA[ABCDE12345]]>
Any suggestions? Thanks for your help in advance.
On Friday 16 May 2008 14:50:07 Radu Preotiuc-Pietro wrote:
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:bryc...@ihsadvantage.com] Sent: Thursday, May 15, 2008 11:49 AM To: us...@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: user...@xmlbeans.apache.org For additional commands, e-mail: user...@xmlbeans.apache.org
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: user...@xmlbeans.apache.org For additional commands, e-mail: user...@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user...@xmlbeans.apache.org For additional commands, e-mail: user...@xmlbeans.apache.org
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.
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.








.dat