[xml] Encoding Entities using LIBXML

Hello all,

I would like to use libxml++ to produce an xml file from a plain text file
which contains xml entities but without replacing the entities with the
corresponding characters. For example, if the input text file contains the

       I'm happy.

I want the xml file to be produced as follows:

<?xml version="1.0"?>
  <line>I&apos;m happy</line>

While libxml++ keeps the entities corresponding to "<" and ">" intact, it
replaces other entities such as &apos; with the corresponding characters.
I understand that ' is a valid character within a text node in xml but my
application requires xml entities to be unsubstituted.
I used the method xmlNewChild to create a new child node and I tried to
turn on automatic substitution of entities but the program is still
replacing the entities.
I also used the method htmlEntitiesEncoding() to convert my whole sentence
and put it on buffer, I used this buffer after to create the node, the
result still the same, I know that it is correct to keep the quote and
apostrophe but my work need it to be changed, by the way, the "&" is not
encoded, I have a format error,
Is there any clean, idiomatic way to do this using libxml++?

Thanks for your help.

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