Re: [xml] Can I force encoding of single-quote characters?



On Thu, Jun 26, 2008 at 10:25:23AM -0400, jwert ilstechnology com wrote:
I'm using libxml2 with an embedded SQL database, and it really doesn't 
like single quote characters in SQL statements.  All of our xml uses 
double-quotes to encapsulate attribute values, and if I read this 
statement correctly:

'
The apostrophe or single-quote character (') can be symbolised with this 
character entity reference when you need to embed a single-quote or 
apostrophe inside a string which is already single-quoted. 

Then when i use the xmlwriter i get "'" (double, single, double quotes). 
What I want to get is "'" Is there some flag I can enable for the 
writer so I don't have to check for this case manually?

  No flag. I don't know how to do this for the writer. For the xmlsave
module, when saving a tree you can use the xmlSaveSetEscape() to define
a custom escaping routine to be used by the serializer. But this option
is not available in the writer ...

  So I have no obvious soluton for you. in general libxml2 is about
providing support for the XML spec and what you're asking is beyond
the requirement of the spec.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]