> What I wonder is, how does SAX decide what is ignorable
> whitespace and what is significant? I'm not clear on how that
> works, and the role xml:space plays in defining that.
> Ignoring whitespace is one of the most tedious things I keep doing
> in my XML parsing apps, I'd prefer to have to explicitly *work* to
> keep whitespace.
> What I don't understand is, given something like this in a DTD:
I think for problems like this, the application should just filter it all out
itself which is very simple.
Here is an inefficient implementation that will do just that for you in Java for
instance:
String data = "Fee Fi Fo\n\n\n Fum\t\t\t ";
java.util.StringTokenizer st = new StringTokenizer(data);
StringBuffer buffer = new StringBuffer();
while (st.hasMoreTokens()) {
buffer.append(st.nextToken());
buffer.append(' ');
}
buffer.setLength(buffer.length()-1);
String result = buffer.toString();
Result should be "Fee Fi Fo Fum"