Re: [xml] Use of the "&" character in the content of a Node



* Unai Astorquiza <uastorquiza pandasoftware es> [2006-05-18 16:50]:
Which is the correct way to put the content "111&222" in the
node? I mean, to get the following result:

<node>111&222</node>

That is malformed XML. It must be `<node>111&amp;222</node>`.

 nodePtr = xmlNewNode(NULL, "node");
 if (nodePtr)
 {
   xmlNodeSetContent(nodePtr, "111&222");
 }


    nodePtr = xmlNewNode(NULL, "node");
    if (nodePtr)
    {
        xmlNodeAddContent(nodePtr, "111&222");
    }

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



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