You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Matthias Hopfer <Ma...@eureka.de> on 2010/02/19 09:06:24 UTC

[v2.8] ignoring white spaces within text-nodes

Hi there,

Is there any way to tell xerces to ignore whitespaces within text-nodes?

<IndxEvt  TimeStampEvt="2010-02-18 11:40:42">
vs
<IndxEvt TimeStampEvt="2010-02-18 11:40:42">

parser->setIncludeIgnorableWhitespace ( false );
parser->setIncludeIgnorableWhitespace ( true );

does make no difference.
Or is there any combination of features to be set?

Any hints?
-mh

PS: no validation scheme is used

Re: [v2.8] ignoring white spaces within text-nodes

Posted by Sanat Talmaki <sa...@gmail.com>.
hi Matthias,

I was having similar trouble. I suggest looking through the source code for
the examples bundled with xerces- such as DOMPrint, DOMCount. Those should
help you by prviding you with large amounts of code as well.

Thanks,

Sanat.

On Fri, Feb 19, 2010 at 3:06 AM, Matthias Hopfer <Matthias.Hoepfer@eureka.de
> wrote:

> Hi there,
>
> Is there any way to tell xerces to ignore whitespaces within text-nodes?
>
> <IndxEvt  TimeStampEvt="2010-02-18 11:40:42">
> vs
> <IndxEvt TimeStampEvt="2010-02-18 11:40:42">
>
> parser->setIncludeIgnorableWhitespace ( false );
> parser->setIncludeIgnorableWhitespace ( true );
>
> does make no difference.
> Or is there any combination of features to be set?
>
> Any hints?
> -mh
>
> PS: no validation scheme is used
>

Re: [v2.8] ignoring white spaces within text-nodes

Posted by David Bertoni <db...@apache.org>.
On 2/19/2010 12:06 AM, Matthias Hopfer wrote:
> Hi there,
>
> Is there any way to tell xerces to ignore whitespaces within text-nodes?
>
> <IndxEvt  TimeStampEvt="2010-02-18 11:40:42">
> vs
> <IndxEvt TimeStampEvt="2010-02-18 11:40:42">
This is not whitespace in a text node, it's whitespace in markup. This 
kind of whitespace is not part of the infoset, and the parser doesn't 
distinguish between the two.

>
> parser->setIncludeIgnorableWhitespace ( false );
> parser->setIncludeIgnorableWhitespace ( true );
>
> does make no difference.
> Or is there any combination of features to be set?
>
> Any hints?
For the parser to know that whitespace is ignorable, you need a DTD that 
defines an element's content as element-only, and you need to validate 
the document with that DTD.

Dave