List Info

Thread: Use of the "&" character in the content of a Node




Use of the "&" character in the content of a Node
user name
2006-05-18 16:31:50
Thanks for your help , I'll try
both ways (xmlNewText and escape properly all the especial
characters).



> -----Mensaje original-----
> De: xml-bouncesgnome.org [mailtoml-bo
uncesgnome.org]En 
> nombre de A.
> Pagaltzis
> Enviado el: jueves, 18 de mayo de 2006 18:26
> Para: xmlgnome.org
> Asunto: Re: [xml] Use of the "&"
character in the content of a Node
> 
> 
> * A. Pagaltzis <pagaltzisgmx.de> [2006-05-18
18:10]:
> > >  nodePtr = xmlNewNode(NULL,
"node");
> > >  if (nodePtr)
> > >  {
> > >    xmlNodeSetContent(nodePtr,
"111&222");
> > >  }
> > 
> > 
> >     nodePtr = xmlNewNode(NULL,
"node");
> >     if (nodePtr)
> >     {
> >         xmlNodeAddContent(nodePtr,
"111&222");
> >     }
> 
> Err, they’re probably both equally wrong. I *think*
you want
> this:
> 
>     nodePtr = xmlNewNode(NULL, "node");
>     textPtr = xmlNewText("111&222");
>     if (nodePtr && textPtr)
>     {
>         xmlAddChild(nodePtr, textPtr);
>     }
> 
> But I can’t check right now.
> 
> In any case, the correct solution will take the string
"111&222"
> and automatically put the properly escaped
"111&amp;222" into the
> text node.
> 
> Regards,
> -- 
> Aristotle Pagaltzis // <http://plasmasturm.org/&g
t;
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/
> xmlgnome.org
> http://mai
l.gnome.org/mailman/listinfo/xml
> 
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )