Re: [xml] escaping and unescaping

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Thu Dec 09 1999 - 10:54:57 EST


On Sun, Dec 05, 1999 at 06:31:40PM -0500, David Helder wrote:
>
>
> I want to make a node like this:
> <topic name="software & hardware">
> by doing this:
> xmlSetProp(topic_node, "name", "software & hardware");
>
> But libxml complains of an unterminated entity because of the &. From
> looking at the documentation, I think I need to use
> xmlEncodeEntitiesReentrant, which will convert the & to something. Is
> this right?

  yes this WAs right, I changed it recently since nobody liked the
old way of letting the application take care of the substitution.

> How do I decode it? Thanks!

  The entity substitution is done automatically by xmlGetProp():
http://xmlsoft.org/gnome-xml-tree.html#XMLGETPROP

I did uniformize the behaviour od xmlSetProp, so taht the entity
substitution is done automatically. So if you update from
a version on the CVS base the problem should be fixed

http://dev.w3.org/cvsweb/XML/tree.c.diff?r1=1.66&r2=1.67

The fix was also comitted in the Gnome CVS base,

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rufus.w3.org
Archived at : http://rufus.w3.org/veillard/XML/messages
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rufus.w3.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:53 EDT