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 Ingolf Steinbach <in...@jena-optronik.de> on 2002/07/25 13:14:56 UTC

DOMWriter: "pretty printing" problems

Hi,

after making sure that the DOMWriter supports the pretty
printing feature (via canSetFeature()), I have set the
feature for the DOMWriter object.

And indeed, the preamble changes from
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE Report SYSTEM "report.dtd">
to
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE Report SYSTEM "report.dtd">

However, all following text is still written in one line:
<Report><Abc><Def>foo</Def><Ghi>bar</Ghi></Abc></Report>
instead of something like:
<Report>
 <Abc>
  <Def>foo</Def>
  <Ghi>bar</Ghi>
 </Abc>
</Report>

Am I missing something?

Environment: 32-bit binary distribution of xerces-c 2.0.0 for AIX.

Kind regards
    Ingolf
-- 

Ingolf Steinbach                       Jena-Optronik GmbH
ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04

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


Re: DOMWriter: "pretty printing" problems

Posted by Gert van Spijker <ge...@ab-graph.com>.
Does that imply that, if one wants real pretty print, white space has to
added to the DOM tree (as #text nodes) if the tree was created in Memory
rather than built from parsing a pretty printed file? Quite cumbersome I
would say. Would it be an idea to tell DOMWriter to do this by calling a
single member function?

Gert

----- Original Message -----
From: "Tinny Ng" <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>
Sent: Thursday, July 25, 2002 1:36 PM
Subject: Re: DOMWriter: "pretty printing" problems


> I think the "pretty print" in DOMWriter only pretty print anything before
> and after the root element.   The content inside the root element, the
> DOMWriter just prints as is.   Since the content model of the root element
> may allow mixed content, or may already have TEXT nodes that contain
> ignorable whitespace.   The DOMWriter decided not to touch anything inside
> the root element and print them as is.   Since DOM L3 spec does not
> specified the behaviour of "pretty print" in details, so we design such
> feature to only pretty print the prolog and epilog.
>
> Tinny
>
> ----- Original Message -----
> From: "Ingolf Steinbach" <in...@jena-optronik.de>
> To: "Xerces C Mailing List" <xe...@xml.apache.org>
> Sent: Thursday, July 25, 2002 7:14 AM
> Subject: DOMWriter: "pretty printing" problems
>
>
> > Hi,
> >
> > after making sure that the DOMWriter supports the pretty
> > printing feature (via canSetFeature()), I have set the
> > feature for the DOMWriter object.
> >
> > And indeed, the preamble changes from
> > <?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE Report
> SYSTEM "report.dtd">
> > to
> > <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> > <!DOCTYPE Report SYSTEM "report.dtd">
> >
> > However, all following text is still written in one line:
> > <Report><Abc><Def>foo</Def><Ghi>bar</Ghi></Abc></Report>
> > instead of something like:
> > <Report>
> >  <Abc>
> >   <Def>foo</Def>
> >   <Ghi>bar</Ghi>
> >  </Abc>
> > </Report>
> >
> > Am I missing something?
> >
> > Environment: 32-bit binary distribution of xerces-c 2.0.0 for AIX.
> >
> > Kind regards
> >     Ingolf
> > --
> >
> > Ingolf Steinbach                       Jena-Optronik GmbH
> > ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
> > PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04
> >
> > ---------------------------------------------------------------------
> > 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: DOMWriter: "pretty printing" problems

Posted by Ingolf Steinbach <in...@jena-optronik.de>.
* Tinny Ng <tn...@ca.ibm.com> [2002-07-25 14:36]:
> The content inside the root element, the
> DOMWriter just prints as is.   Since the content model of the root element
> may allow mixed content, or may already have TEXT nodes that contain
> ignorable whitespace.

Is there any help provided by the library to pre-format
the tree before serializing it?

Regards
    Ingolf
-- 

Ingolf Steinbach                       Jena-Optronik GmbH
ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04

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


Re: DOMWriter: "pretty printing" problems

Posted by Tinny Ng <tn...@ca.ibm.com>.
I think the "pretty print" in DOMWriter only pretty print anything before
and after the root element.   The content inside the root element, the
DOMWriter just prints as is.   Since the content model of the root element
may allow mixed content, or may already have TEXT nodes that contain
ignorable whitespace.   The DOMWriter decided not to touch anything inside
the root element and print them as is.   Since DOM L3 spec does not
specified the behaviour of "pretty print" in details, so we design such
feature to only pretty print the prolog and epilog.

Tinny

----- Original Message -----
From: "Ingolf Steinbach" <in...@jena-optronik.de>
To: "Xerces C Mailing List" <xe...@xml.apache.org>
Sent: Thursday, July 25, 2002 7:14 AM
Subject: DOMWriter: "pretty printing" problems


> Hi,
>
> after making sure that the DOMWriter supports the pretty
> printing feature (via canSetFeature()), I have set the
> feature for the DOMWriter object.
>
> And indeed, the preamble changes from
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE Report
SYSTEM "report.dtd">
> to
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <!DOCTYPE Report SYSTEM "report.dtd">
>
> However, all following text is still written in one line:
> <Report><Abc><Def>foo</Def><Ghi>bar</Ghi></Abc></Report>
> instead of something like:
> <Report>
>  <Abc>
>   <Def>foo</Def>
>   <Ghi>bar</Ghi>
>  </Abc>
> </Report>
>
> Am I missing something?
>
> Environment: 32-bit binary distribution of xerces-c 2.0.0 for AIX.
>
> Kind regards
>     Ingolf
> --
>
> Ingolf Steinbach                       Jena-Optronik GmbH
> ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
> PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04
>
> ---------------------------------------------------------------------
> 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: DOMWriter: "pretty printing" problems

Posted by Scot Nielsen <sc...@yahoo.co.uk>.
If you are, I'm missing the same thing on Win32 platforms also...

I thought I had this working once but realised the file I'd read and then
serialized again was already nicely formatted. I've also played around with
CR - LF options but didn't seem to get anywhere with those either.

-----Original Message-----
From: Ingolf Steinbach [mailto:ingolf.steinbach@jena-optronik.de]
Sent: 25 July 2002 12:15
To: Xerces C Mailing List
Subject: DOMWriter: "pretty printing" problems

Hi,

after making sure that the DOMWriter supports the pretty
printing feature (via canSetFeature()), I have set the
feature for the DOMWriter object.

And indeed, the preamble changes from
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE Report
SYSTEM "report.dtd">
to
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE Report SYSTEM "report.dtd">

However, all following text is still written in one line:
<Report><Abc><Def>foo</Def><Ghi>bar</Ghi></Abc></Report>
instead of something like:
<Report>
 <Abc>
  <Def>foo</Def>
  <Ghi>bar</Ghi>
 </Abc>
</Report>

Am I missing something?

Environment: 32-bit binary distribution of xerces-c 2.0.0 for AIX.

Kind regards
    Ingolf
--

Ingolf Steinbach                       Jena-Optronik GmbH
ingolf.steinbach@jena-optronik.de       ++49 3641 200-147
PGP: 0x7B3B5661  213C 828E 0C92 16B5  05D0 4D5B A324 EC04

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

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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