On Fri, May 15, 2015 at 1:35 PM, Zia -Ur-Rehman <zia....@hotmail.com> wrote:

> Hi,
>       I am using libXML (version 2.7.8.7) on windows. I am trying to
> insert data into existing XML file but problem is that after insertion CR
> character is converted to LF it not only swap CR to LF in inserted string
> but also swap all existing CR characters in output file. I don't know where
> is problem is there some solution to this like by setting some encoding
> scheme? Or i have to make changes in source code (if that solves the
> problem).
>        Attached picture is to clarify problem. I am reading "Hello" node
> from read.xml and inserting its text to "Example" node of write.xml.
>
>
>

It is behavior required by standard.

See: http://www.w3.org/TR/xml/#sec-line-ends

2.11 End-of-Line Handling

XML parsed entities are often stored in computer files which, for editing
convenience, are organized into lines. These lines are typically separated
by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED
(#xA).

To simplify the tasks of applications, the XML processor MUST behave as if
it normalized all line breaks in external parsed entities (including the
document entity) on input, before parsing, by translating both the
two-character sequence #xD #xA and any #xD that is not followed by #xA to a
single #xA character.

-- 
Andrew W. Nosenko <andrew.w.nose...@gmail.com>
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to