It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes Simple, but Possible? IgnoreWhiteSpace! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Simple, but Possible? IgnoreWhiteSpace!" Watch "Simple, but Possible? IgnoreWhiteSpace!" New topic

Simple, but Possible? IgnoreWhiteSpace!


Joined: Jul 20, 2003
Posts: 6
This question may be asked several times, but I want to find whether there is a wrok around for it.
A very simple documemt like this:

After it is parsed by DOMParser, <A> will have 3 children (2 of them are just #text node). Now, if I do not have a DTD, is there any quick way to NOT include these two #text node in final DOM? setIgnoreWhitespace() simply does not work!
I do not want 2 #text nodes in my parsed document.
Thanks for any helps!
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
I don't think there is without a DTD, you need it to know whether or not the whitespace is in fact ignorable. How much control do you have over the format it comes in? Could you safely make an assumption that all nodes that contain only whitespace are ignorable for example?
I agree. Here's the link:
subject: Simple, but Possible? IgnoreWhiteSpace!
It's not a secret anymore!