how to ignore white spaces in DOM

hi friendscan anyone tell me how to ignore white spaces and related characters when usin dom.
[107 byte] By [timebomba] at [2007-10-3 9:24:02]
# 1
DOM seperates arguments from elements by using a white space between them, however, the content of an element may also contain white space as well.You should be using a DOM praser of a correct type or associate a DTD with it.
watertownjordana at 2007-7-15 4:37:56 > top of Java-index,Java Essentials,Java Programming...
# 2

> can anyone tell me how to ignore white spaces and

> related characters when usin dom.

I'm assuming that you're talking about the newlines and spaces from a pretty-printed document, which are showing up in your Text nodes?

The easiest way is to simply call trim() on the string value of the text nodes, and ignore those that are empty afterwards. There is a method on Text, isElementContentWhitespace(), that can be used to determine whether the node contains "ignorable whitespace," but that doesn't help when the node contains non-text characters.

As a caveat, you should pay attention to the [url=http://www.xml.com/axml/target.html#sec-white-space]xml:space[/url] attribute.

kdgregorya at 2007-7-15 4:37:56 > top of Java-index,Java Essentials,Java Programming...