OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: xml:space

[ Lists Home | Date Index | Thread Index ]
  • From: Tyler Baker <tyler@infinet.com>
  • To: "Michael J. Suzio" <msuzio@ford.com>
  • Date: Mon, 23 Feb 1998 12:19:27 -0500

Michael J. Suzio wrote:

> 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"


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


  • References:
    • xml:space
      • From: Peter Murray-Rust <peter@ursus.demon.co.uk>
    • Re: xml:space
      • From: "Michael J. Suzio" <msuzio@ford.com>



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS