You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Bruce Bailey <bj...@plaza.ds.adp.com> on 2000/12/05 00:30:09 UTC

Sax 'characters' method and ignoring Whitespace

Hi

I notice that when I am using the Sax parser, I receive the whitespace data
as well as the data contained in the element.  How can I ignore the
whitespace or strip it out of the input data?

Thanks,

Bruce

Re: Sax 'characters' method and ignoring Whitespace

Posted by Khaled Noaman <kn...@ca.ibm.com>.
The whitespace chars are only reported if you are using a validating parser. If
you use a non-validating parser, the spaces are returned via the characters()
callback.

Regards,
Khaled Noaman
XML Parser Dev. - IBM Toronto Lab
knoaman@ca.ibm.com

Mike Herring wrote:

> At this point I am not using a DTD.  The "missing" whitespace is not being
> returned via the characters() or ignorableWhitespace() callbacks.  Where
> else can I look?
>
> ----- Original Message -----
> From: "Dean Roddey" <dr...@charmedquark.com>
> To: <xe...@xml.apache.org>
> Sent: Monday, December 04, 2000 9:29 PM
> Subject: Re: Sax 'characters' method and ignoring Whitespace
>
> > Its delivering them, you just probably aren't looking in the right place.
> > According to XML rules, if you are using a DTD and the element's content
> > model is CHILDREN style, then the whitespace is delivered as 'ignorable
> > whitespace'. If the content model allows character data, then its
> delivered
> > as 'characters'. So make sure you are handling both of those SAX APIs if
> you
> > are using a DTD.
> >
> > --------------------------
> > Dean Roddey
> > The CIDLib C++ Frameworks
> > Charmed Quark Software
> > droddey@charmedquark.com
> > http://www.charmedquark.com
> >
> > "It takes two buttocks to make friction"
> >     - African Proverb
> >
> >
> > ----- Original Message -----
> > From: "Mike Herring" <mi...@worldnet.att.net>
> > To: <xe...@xml.apache.org>
> > Sent: Monday, December 04, 2000 9:10 PM
> > Subject: Re: Sax 'characters' method and ignoring Whitespace
> >
> >
> > > I just noticed today that the SAX parser was NOT delivering white space
> > that
> > > was part of a text node element!  And I need it!  Maybe someone
> > > knowledgeable can address this one.
> > >
> > >
> > > ----- Original Message -----
> > > From: "Bruce Bailey" <bj...@plaza.ds.adp.com>
> > > To: "'Xerces List'" <xe...@xml.apache.org>
> > > Sent: Monday, December 04, 2000 3:30 PM
> > > Subject: Sax 'characters' method and ignoring Whitespace
> > >
> > >
> > > > Hi
> > > >
> > > > I notice that when I am using the Sax parser, I receive the whitespace
> > > data
> > > > as well as the data contained in the element.  How can I ignore the
> > > > whitespace or strip it out of the input data?
> > > >
> > > > Thanks,
> > > >
> > > > Bruce
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

Re: Sax 'characters' method and ignoring Whitespace

Posted by Mike Herring <mi...@worldnet.att.net>.
At this point I am not using a DTD.  The "missing" whitespace is not being
returned via the characters() or ignorableWhitespace() callbacks.  Where
else can I look?

----- Original Message -----
From: "Dean Roddey" <dr...@charmedquark.com>
To: <xe...@xml.apache.org>
Sent: Monday, December 04, 2000 9:29 PM
Subject: Re: Sax 'characters' method and ignoring Whitespace


> Its delivering them, you just probably aren't looking in the right place.
> According to XML rules, if you are using a DTD and the element's content
> model is CHILDREN style, then the whitespace is delivered as 'ignorable
> whitespace'. If the content model allows character data, then its
delivered
> as 'characters'. So make sure you are handling both of those SAX APIs if
you
> are using a DTD.
>
> --------------------------
> Dean Roddey
> The CIDLib C++ Frameworks
> Charmed Quark Software
> droddey@charmedquark.com
> http://www.charmedquark.com
>
> "It takes two buttocks to make friction"
>     - African Proverb
>
>
> ----- Original Message -----
> From: "Mike Herring" <mi...@worldnet.att.net>
> To: <xe...@xml.apache.org>
> Sent: Monday, December 04, 2000 9:10 PM
> Subject: Re: Sax 'characters' method and ignoring Whitespace
>
>
> > I just noticed today that the SAX parser was NOT delivering white space
> that
> > was part of a text node element!  And I need it!  Maybe someone
> > knowledgeable can address this one.
> >
> >
> > ----- Original Message -----
> > From: "Bruce Bailey" <bj...@plaza.ds.adp.com>
> > To: "'Xerces List'" <xe...@xml.apache.org>
> > Sent: Monday, December 04, 2000 3:30 PM
> > Subject: Sax 'characters' method and ignoring Whitespace
> >
> >
> > > Hi
> > >
> > > I notice that when I am using the Sax parser, I receive the whitespace
> > data
> > > as well as the data contained in the element.  How can I ignore the
> > > whitespace or strip it out of the input data?
> > >
> > > Thanks,
> > >
> > > Bruce
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


Re: Sax 'characters' method and ignoring Whitespace

Posted by Dean Roddey <dr...@charmedquark.com>.
Its delivering them, you just probably aren't looking in the right place.
According to XML rules, if you are using a DTD and the element's content
model is CHILDREN style, then the whitespace is delivered as 'ignorable
whitespace'. If the content model allows character data, then its delivered
as 'characters'. So make sure you are handling both of those SAX APIs if you
are using a DTD.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"It takes two buttocks to make friction"
    - African Proverb


----- Original Message -----
From: "Mike Herring" <mi...@worldnet.att.net>
To: <xe...@xml.apache.org>
Sent: Monday, December 04, 2000 9:10 PM
Subject: Re: Sax 'characters' method and ignoring Whitespace


> I just noticed today that the SAX parser was NOT delivering white space
that
> was part of a text node element!  And I need it!  Maybe someone
> knowledgeable can address this one.
>
>
> ----- Original Message -----
> From: "Bruce Bailey" <bj...@plaza.ds.adp.com>
> To: "'Xerces List'" <xe...@xml.apache.org>
> Sent: Monday, December 04, 2000 3:30 PM
> Subject: Sax 'characters' method and ignoring Whitespace
>
>
> > Hi
> >
> > I notice that when I am using the Sax parser, I receive the whitespace
> data
> > as well as the data contained in the element.  How can I ignore the
> > whitespace or strip it out of the input data?
> >
> > Thanks,
> >
> > Bruce
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


Re: Sax 'characters' method and ignoring Whitespace

Posted by Mike Herring <mi...@worldnet.att.net>.
I just noticed today that the SAX parser was NOT delivering white space that
was part of a text node element!  And I need it!  Maybe someone
knowledgeable can address this one.


----- Original Message -----
From: "Bruce Bailey" <bj...@plaza.ds.adp.com>
To: "'Xerces List'" <xe...@xml.apache.org>
Sent: Monday, December 04, 2000 3:30 PM
Subject: Sax 'characters' method and ignoring Whitespace


> Hi
>
> I notice that when I am using the Sax parser, I receive the whitespace
data
> as well as the data contained in the element.  How can I ignore the
> whitespace or strip it out of the input data?
>
> Thanks,
>
> Bruce
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>