xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralf Pfeiffer <rpfei...@apache.org>
Subject Re: Printing a document without whitespace between the elements
Date Sat, 15 Jan 2000 00:44:51 GMT
The ignore ignorableWhitespace functionality that you are attempting to
provide has recently  been implemented. Please extract the latest, and check
out the new
Xerces feature (comments from the DOMParser code):

            //
http://apache.org/xml/features/dom/include-ignorable-whitespace
            //   This feature determines whether text nodes that can be
            //   considered "ignorable whitespace" are included in the DOM
            //   tree.
            //   Note: The only way that the parser can determine if text
            //         is ignorable is by reading the associated grammar
            //         and having a content model for the document. When
            //         ignorable whitespace text nodes *are* included in
            //         the DOM tree, they will be flagged as ignorable.
            //         The ignorable flag can be queried by calling the
            //         TextImpl#isIgnorableWhitespace():boolean method.


"Truong, Bon" wrote:

> Hi,
>
> I have written class that extends DOMParser. In that class I override the
> method "ignorableWhitespace",
> which looks like this:
>
>    public void ignorableWhitespace(int dataIndex) throws Exception
>     {
>     if(! NotIncludeIgnorableWhiteSpaces )
>        super.ignorableWhitespace( dataIndex);
>     else
>        ;// Ignore ignorable white spaces
>     }// ignorableWhitespace
>
> In the same class, there is also a method "print",
> which has one switch case like this one:
>
>          case Node.TEXT_NODE: {
>
>              out.print(normalize(node.getNodeValue()));
>
>              break;
>           }
>
> But when I run the program it prints the whitespace between the elements.
> How can I get it not to print all the whitespace?
>
> Thanks.
>
> Bon


Mime
View raw message