[xml] Encoding Entities using LIBXML
- From: "BELOUCIF Meriem" <mbeloucif ust hk>
- To: xml gnome org
- Subject: [xml] Encoding Entities using LIBXML
- Date: Tue, 23 Apr 2013 17:18:10 +0800 (HKT)
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
line
I'm happy.
I want the xml file to be produced as follows:
<?xml version="1.0"?>
<document>
<line>I'm happy</line>
</document>
While libxml++ keeps the entities corresponding to "<" and ">" intact, it
replaces other entities such as ' 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.
Regards
Meriem,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]