On Thu, Jun 12, 2008 at 09:10:40AM +0200, K.Karamazen wrote:
> On Wed, 2008-06-11 at 15:59 +0100, Pete Cordell wrote:
> > Original Message From: "Daniel Veillard"
> > > On Wed, Jun 11, 2008 at 08:52:06AM +0200, K.Karamazen wrote:
> > >> What is the standard way to encode raw data into CDATA section?
> > >
> > >  base64
> > 
> > And you don't actually need to wrap the base64 in a CDATA section.  Just 
> > make the base64 your element or attribute content.
> > 
> > HTH,
> > 
> > Pete Cordell
> > Codalogic
> > For XML C++ data binding visit http://www.codalogic.com/lmx/
> > 
> > 
> Yes, thank you. I forgot to say that only characters 0x20-0x7e may be
> used in the encoding and that they are not escaped if not needed (i.e.
> in that range only ']]>' escaped) so that:
> 1) the text remains readable
> 2) the text can be edited with a simple editor 
> 
> Is there such possibility in libxml2?

  Libxml2 follows the XML spec. What you need to read is
    http://www.w3.org/TR/REC-xml/#charsets
and
    http://www.w3.org/TR/REC-xml/#sec-cdata-sect

You will need to "invent" a way to encode characters which are not text
from an XML perspective, and "decode" them on the receiving side.
I doubt any standard editor will do that for you.
Basically XML was designed so that you can't just dump garbage in an XML
document and let the receiving side deal with the mess. You need to clean
up when creating the documents. That's true for CDATA or normal text, there
is no workaround.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to