why are some text nodes empty when read xml with parser

Why are some Text nodes empty?

In XML, all whitespace has to be passed through to the application. This means
that if you have whitespace, such as carriage returns, between tags in your
source file, these have to be passed through, even if they’re just there for
pretty-printing. The DOM implementation has to put this whitespace somewhere,
and the only possibility is a text node. Thus you will get text nodes which
look empty, but in fact have a carriage return or other whitespace in them.

Note that some DOM implementations, which do not consider whitespace in
element content to be meaningful for the XML languages they support, discard
these whitespace nodes before exposing the DOM to their users.

Avoid Empty Text Nodes

Firefox, and some other browsers, will treat empty white-spaces or new lines
as text nodes, Internet Explorer will not.

This causes a problem when using the properties: firstChild, lastChild,
nextSibling, previousSibling.

To avoid navigating to empty text nodes (spaces and new-line characters
between element nodes), we use a function that checks the node type:

function get_nextSibling(n)
{
y=n.nextSibling;
while (y.nodeType!= 1 )
{
y=y.nextSibling;
}
return y;
}

The function above allows you to use get_nextSibling( node ) instead of the
property node .nextSibling.

Code explained:

Element nodes are type 1. If the sibling node is not an element node, it moves
to the next nodes until an element node is found. This way, the result will be
the same in both Internet Explorer and Firefox.

http://www.w3schools.com/dom/dom_nodes_navigate.asp

www.w3.org/DOM/faq.html#emptytext