Re: [xml] saving to file with new lines

On 02.06.2004 10:15, Jinho Suk wrote:

Thank you for your help. I just tested this function. It still gives me a long long line of xml. Does this function put line feeds only when the original had new line feeds?

Depends on your XML. Tags like this one:

  <tag att="val" ... />

will remain on one line. Text nodes with more than just ignorable whitespace like this one:

  <tag> text content </tag>

will remain on one line, because adding line breaks in the middle of the text node would change data. A nodeset such as this:

  <tag> text </tag><tag> text </tag>

could end broken up like this:

  <tag> text </tag>
  <tag> text </tag>

provided the element which encloses those tags has no text nodes which contain more than ignorable whitespace.

Best is to save your XML in a file as it is and then check the formatting results with 'xmllint --format'. That will give you an idea.


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