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 da...@mlc.com.au on 2001/09/04 05:54:02 UTC

Parser Functionality

How does DOMSerializer keep formatting instructions from the input XML.

Here is what my program does.

Parse an input string into 'document' then print the document with the
DOMSerializer class.

eg

why is the following XML printed "as is"
<root><child1>34</child1>
<child2>45</child2></root>

and not

<root>
<child1>34</child1>
<child2>45</child2>
</root>

or at least

<root><child1>34</child1><child2>45</child2></root>

does this mean that somewhere in the document object that there are
formatting instructions?




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Parser Functionality

Posted by Evert Haasdijk <ev...@zukkespijkers.nl>.
The whitespace in the document is read and stored by the parser. The
DOMWriter simply writes everything (including whitespace) in the document.
To strip ignorable whitespace, set the parser's flag to exclude it with
DOMParser::setIncludeIgnorableWhitespace(false);

Ta, evert

> -----Original Message-----
> From: dan_mclean@mlc.com.au [mailto:dan_mclean@mlc.com.au]
> Sent: Tuesday, September 04, 2001 5:54 AM
> To: xerces-c-dev@xml.apache.org
> Subject: Parser Functionality
>
>
>
> How does DOMSerializer keep formatting instructions from the input XML.
>
> Here is what my program does.
>
> Parse an input string into 'document' then print the document with the
> DOMSerializer class.
>
> eg
>
> why is the following XML printed "as is"
> <root><child1>34</child1>
> <child2>45</child2></root>
>
> and not
>
> <root>
> <child1>34</child1>
> <child2>45</child2>
> </root>
>
> or at least
>
> <root><child1>34</child1><child2>45</child2></root>
>
> does this mean that somewhere in the document object that there are
> formatting instructions?
>
>
>
>
> ---------------------------------------------------------------------
> 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