[XML-SIG] Removing insignificant whitespace

Brian Quinlan brian at sweetapp.com
Wed Sep 1 11:30:28 CEST 2004


Thomas B. Passin wrote:
> True.  I probably misunderstood the question.  Once you run normalize(), 
> you don't have whitespace-only nodes in content anymore (unless the 
> content is only whitespace, that is) - those nodes have been absorbed 
> into other content nodes.

Yes, but whitespace-only nodes are very common in XML formatted for 
human consumption e.g.

<foo>
	<bar>Hello</bar>
	<bar>Hi</bar>
</foo>

I count 3 whitespace-only nodes (even after normalize). Those nodes are 
not useful to the application some I'm wondering about the canonical 
way of removing them (without writing the [admittedly simple] code myself).

Cheers,
Brian



More information about the XML-SIG mailing list