Hi David,

 

This is an issue that was requested before, and we didn’t have a good answer for it for quite a while.

Since the CDATA is not part of the xml info set, the regular text and CDATA are both stored as text in the xml in-memory store, so saving will not preserve the CDATA blocks.

But, I checked in yesterday two new options that will allow one to control when CDATA is used when saving to text: XmlOptions setSaveCDataLengthThreshold() and setSaveCDataEntityCountThreshold().

 

So, get the latest sources from SVN and give it a try.

 

Cezar

 


From: Lewis, David [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 26, 2006 12:29 PM
To: user@xmlbeans.apache.org; dev@xmlbeans.apache.org
Subject: RE: How to preserve CDATA sections?

 

As nobody has (yet) responded to my XMLBeans problem, I thought that I would repost it to both the “user” and “dev” mailing lists …

 


From: Lewis, David [mailto:[EMAIL PROTECTED]
Sent: July 20, 2006 3:19 PM
To: user@xmlbeans.apache.org
Cc: Murphy, Eric
Subject: How to preserve CDATA sections?

 

Using XMLBeans 2.2.0, if I parse an XML document that contains CDATA sections to escape blocks of text, when I save the document to a file system – the CDATA sections are no longer preserved and literals that may be interpreted as markup (such as an ampersand) are written out in their escaped form.

 

For example, it the source document contains:

<element><![CDATA[fred&ethyl]]></element>

… it is saved as:

<element>fred&amp;ethyl</element>

 

Any ideas how to preserve the CDATA sections?

 

Thanks!

 

~ David

 

David Lewis
Software Developer – National Forest Information System/

Concepteur de logiciels – Système national d’information forestière

 

Natural Resources Canada                     Ressources naturelles Canada             

Canadian Forest Service.                       Service canadien des forêts

506 West Burnside Road                  506, chemin ouest Burnside

Victoria, B.C. V8Z 1M5                           Victoria, (C.-B.), V8Z 1M5

 

Telephone:  (250) 363 0710                    Téléphone:  (250) 363 0710

Facsimile:   (250) 363 0775                     Télécopier:  (250) 363 0775

Email: dlewis@ pfc.cfs.nrcan.gc.ca       Courriel: [EMAIL PROTECTED]

 

NFIS Website / SNIF Site Web: http://nfis.org/

PFC Website / CFP Site Web: http://pfc.cfs.nrcan.gc.ca/

 

_______________________________________________________________________
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