Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How whitespace (in data) is treated by XML Parser?

Tags:

xml

w3c

If this is a sample XML::

<root>
  <tag1>data
    data
     data</tag1>
  <tag2>
  </tag2>
  <tag3> </tag3>
</root>

This file is viewed differently in different browsers and XML viewer/editors,

some viewers display 1st <tag/> element as <tag>data data data</tag> some display as is,
Some viewers, treat new line as nbsp(space) and some treat space and new line as null,

What is the standard approach for this white-space issue?

like image 750
InfantPro'Aravind' Avatar asked Nov 06 '22 06:11

InfantPro'Aravind'


1 Answers

http://www.w3.org/TR/REC-xml/#sec-white-space

I believe that means it is optional but default behaviour should be to ignore non-significant whitespace.

Can you give me an example of an implementation which is showing the line breaks?

like image 179
jambox Avatar answered Nov 09 '22 10:11

jambox