Re: [xml] CR to LF conversion problem libXML

On Fri, May 15, 2015 at 1:35 PM, Zia -Ur-Rehman <zia 139 hotmail com> wrote:
      I am using libXML (version 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.


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 nosenko gmail com>

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