[yunqa.de] Re: [DIXml] Preserving empty lines/blanks in an XML-file/Hierarchical structure

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Mon, 24 Dec 2007 12:18:56 +0100

Hello WeikEngOff@xxxxxxx,

>I want know how empty lines in an XML-file are usually handled. Is there any 
>"standard" for preserving? How is that handled in your DIXml-library?

DIXml preserves line breaks. This naturally includes empty lines, which are 
just consecutive line breaks.

As required by the XML specicfication (2.11 End-of-Line Handling), DIXml 
converts all line breaks to a single $0A. Here is the relevant passage:

"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."

>Same question with blanks when used for formatting.

When building a DOM node structure, DIXml can automatically remove blank nodes. 
These two functions control this behaviour on a global / thread level:

  function xmlKeepBlanksDefault( Val: C_int): C_int; 
  function xmlThrDefKeepBlanksDefaultValue( v: C_int): C_int; 

For document-specific behaviour, pass the XML_PARSE_NOBLANKS option to  the 
xmlReadFile, xmlCtxtUseOptions, and related functions.

>Is an hierarchical structure (not "flat") possible (export) with your 
>DIXml-library?  

Not exactly sure what you mean, but yes, functions like xmlDocDumpFormatMemory 
do output line breaks and empty lines.

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: