You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Jean-Christophe Broudin <br...@geocities.com> on 2000/03/22 14:42:46 UTC

Strange way to handle white spaces during parsing

Hi,

	We have noticed that, with an XML file such as:

	<A> 
		<B>
			<C> Bono </C>
		</B>
	</A>

	if one asks how many childs <A> tags owns (using getLength() on
getDocumentElement().getChildNodes() ), the answer is
 3. After investigation, whitespaces between <A> and <B>, then between
</B> and </A> are interpreted as text nodes. 

	On the same example, the XML parser included in IE 5.0 ignores these
whitespaces and the answer is 1. We think that 1 is the correct answer.
		
	I really wonder:

		Isn't it weird? 
		Is it the normal behavior? 
		Is there a means to disable this, and have an IE-5.0-like behaviour? 
		Is it an actual compliance to XML and DOM specs?


Regards,

	jean-christophe broudin.

Re: Strange way to handle white spaces during parsing

Posted by Norman Walsh <nd...@nwalsh.com>.
/ Jean-Christophe Broudin <br...@geocities.com> was heard to say:
| 	We have noticed that, with an XML file such as:
| 
| 	<A> 
| 		<B>
| 			<C> Bono </C>
| 		</B>
| 	</A>
| 
| 	if one asks how many childs <A> tags owns (using getLength() on
| getDocumentElement().getChildNodes() ), the answer is
|  3. After investigation, whitespaces between <A> and <B>, then between
| </B> and </A> are interpreted as text nodes. 
| 
| 	On the same example, the XML parser included in IE 5.0 ignores these
| whitespaces and the answer is 1. We think that 1 is the correct answer.

The correct answer is three.