Re: [xml] Problems with the character & and saving/loading XML files
- From: Philip Van Hoof <freax pandora be>
- To: Daniel Gehriger <bulk linkcad com>
- Cc: "'Philip Van Hoof'" <freax pandora be>, xml gnome org
- Subject: Re: [xml] Problems with the character & and saving/loading XML files
- Date: Fri, 19 Apr 2002 16:44:41 +0200
On 2002.04.19 15:20 Daniel Gehriger wrote:
The following two characters must be escaped: '<' and '&'.
You could also use a CDATA section, like this:
<mydata><![CDATA[ ANY DATA ]]></mydata>
, but then you mustn't use "]]>" inside the CDATA section, and there's
no way to escape this sequence. You better don't use CDATA for this
reason. Here's a link with more information:
http://www.w3schools.com/xml/xml_cdata.asp
Okay, thanks a lot..
How do I use <![CDATA[ in the libxml ? When I do something
like this then "<" and ">" will get escaped :
gchar *data;
data = g_strdup_printf("<![CDATA[%s]]>", item->data);
xmlNewChild (itemnode,NULL,"data", data);
And if I don't want to use the <![CDATA[ ]]> tag. What
would be the best way to search/replace the "special"
characters in C ? Normal regular expression, sed like
search/replace ? s/&/&/g ?
--
Philip Van Hoof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]