You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Daniel Barclay <Da...@digitalfocus.com> on 2000/06/09 00:49:24 UTC

how to configure serializer for normal pretty-printed output? bug?

How is one supposed to configure the Serializer classes to get
"normal" indented output (that is, roughly one tag per line)?

OutputFormat.setIndenting( true ) only seems to work partially.
Specifically, it causes lines to be indented when they do wrap,
but it doesn't cause them to wrap after each tag (or piece of
text).  

(The links seem to wrap only where they need to to avoid exceeding 
the maximum line length.)


For example, I get output like this:

...
                <client1>     <CLIENT>      <birth/>      <xyzzyxAge/>
                    <lifeExp/>      <sSecurity>       <XYZZYXDINCOME>
                            <amount/>        <pctOfSBenefit/>
                            <startAge/>        <stopAge/>        <rate/>
                        </XYZZYXDINCOME>      </sSecurity>
                        <pension>       <XYZZYXDINCOME>        <amount/>
                            <pctOfSBenefit/>        <startAge/>
                            <stopAge/>        <rate/>
                        </XYZZYXDINCOME>      </pension>      <other>
                            <XYZZYXDINCOME>        <amount/>


I would have expected something more like:

...
              <client1>
                    <CLIENT>
                        <birth/>
                        <xyzzyxAge/>
                        <lifeExp/>
                        <sSecurity>
                            <XYZZYXDINCOME>
                                <amount/>
                                <pctOfSBenefit/>
                                <startAge/>
                                <stopAge/>
                                <rate/>
                            </XYZZYXDINCOME>
                        </sSecurity>
                        <pension>
                            <XYZZYXDINCOME>
                                <amount/>
                                <pctOfSBenefit/>
                                <startAge/>
                                <stopAge/>
                                <rate/>
                            </XYZZYXDINCOME>
                        </pension>
                        <other>
                            <XYZZYXDINCOME>        
                                <amount/>


Do the serializers just do a different kind of indentation than
I expect?

Is indentation not fully implemented yet?

Is there a bug?

Am I using OutputFormat incorrectly?

Here's how I create my OutputFormat object:

        OutputFormat fmt = new OutputFormat();
        fmt.setIndenting( true );
        fmt.setMethod( "xml" );

(That is, I don't set anything else.)      


Thanks,

Daniel

-- 
Daniel Barclay
Digital Focus
Daniel.Barclay@digitalfocus.com

Re: how to configure serializer for normal pretty-printed output? bug?

Posted by Marc Dzaebel <dz...@kdt.de>.
Arkin,

after calling parser.setIncludeIgnoragbleWhitespace(false);   (1.1.1)
the problem remains and my XML-Source did not include any whitespace.

Marc Dzaebel

----- Original Message -----
From: Arkin <ar...@exoffice.com>
To: <xe...@xml.apache.org>
Sent: Friday, June 09, 2000 7:54 PM
Subject: Re: how to configure serializer for normal pretty-printed output?
bug?


> The document you are reading does not strip whitespaces. The whitespaces
> you see are actually part of the DOM you get, they are not produced by
> the serializer. Turn whitespace stripping on when you parse the document
> and you'll save up some memory.
>
> arkin
>
>
> Daniel Barclay wrote:
> >
> > How is one supposed to configure the Serializer classes to get
> > "normal" indented output (that is, roughly one tag per line)?
> >
> > OutputFormat.setIndenting( true ) only seems to work partially.
> > Specifically, it causes lines to be indented when they do wrap,
> > but it doesn't cause them to wrap after each tag (or piece of
> > text).
> >
> > (The links seem to wrap only where they need to to avoid exceeding
> > the maximum line length.)
> >
> > For example, I get output like this:
> >
> > ...
> >                 <client1>     <CLIENT>      <birth/>      <xyzzyxAge/>
> >                     <lifeExp/>      <sSecurity>       <XYZZYXDINCOME>
> >                             <amount/>        <pctOfSBenefit/>
> >                             <startAge/>        <stopAge/>        <rate/>
> >                         </XYZZYXDINCOME>      </sSecurity>
> >                         <pension>       <XYZZYXDINCOME>        <amount/>
> >                             <pctOfSBenefit/>        <startAge/>
> >                             <stopAge/>        <rate/>
> >                         </XYZZYXDINCOME>      </pension>      <other>
> >                             <XYZZYXDINCOME>        <amount/>
> >
> > I would have expected something more like:
> >
> > ...
> >               <client1>
> >                     <CLIENT>
> >                         <birth/>
> >                         <xyzzyxAge/>
> >                         <lifeExp/>
> >                         <sSecurity>
> >                             <XYZZYXDINCOME>
> >                                 <amount/>
> >                                 <pctOfSBenefit/>
> >                                 <startAge/>
> >                                 <stopAge/>
> >                                 <rate/>
> >                             </XYZZYXDINCOME>
> >                         </sSecurity>
> >                         <pension>
> >                             <XYZZYXDINCOME>
> >                                 <amount/>
> >                                 <pctOfSBenefit/>
> >                                 <startAge/>
> >                                 <stopAge/>
> >                                 <rate/>
> >                             </XYZZYXDINCOME>
> >                         </pension>
> >                         <other>
> >                             <XYZZYXDINCOME>
> >                                 <amount/>
> >
> > Do the serializers just do a different kind of indentation than
> > I expect?
> >
> > Is indentation not fully implemented yet?
> >
> > Is there a bug?
> >
> > Am I using OutputFormat incorrectly?
> >
> > Here's how I create my OutputFormat object:
> >
> >         OutputFormat fmt = new OutputFormat();
> >         fmt.setIndenting( true );
> >         fmt.setMethod( "xml" );
> >
> > (That is, I don't set anything else.)
> >
> > Thanks,
> >
> > Daniel
> >
> > --
> > Daniel Barclay
> > Digital Focus
> > Daniel.Barclay@digitalfocus.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
> --
> ----------------------------------------------------------------------
> Assaf Arkin                                           www.exoffice.com
> CTO, Exoffice Technologies, Inc.                        www.exolab.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>


Re: how to configure serializer for normal pretty-printed output? bug?

Posted by Arkin <ar...@exoffice.com>.
The document you are reading does not strip whitespaces. The whitespaces
you see are actually part of the DOM you get, they are not produced by
the serializer. Turn whitespace stripping on when you parse the document
and you'll save up some memory.

arkin


Daniel Barclay wrote:
> 
> How is one supposed to configure the Serializer classes to get
> "normal" indented output (that is, roughly one tag per line)?
> 
> OutputFormat.setIndenting( true ) only seems to work partially.
> Specifically, it causes lines to be indented when they do wrap,
> but it doesn't cause them to wrap after each tag (or piece of
> text).
> 
> (The links seem to wrap only where they need to to avoid exceeding
> the maximum line length.)
> 
> For example, I get output like this:
> 
> ...
>                 <client1>     <CLIENT>      <birth/>      <xyzzyxAge/>
>                     <lifeExp/>      <sSecurity>       <XYZZYXDINCOME>
>                             <amount/>        <pctOfSBenefit/>
>                             <startAge/>        <stopAge/>        <rate/>
>                         </XYZZYXDINCOME>      </sSecurity>
>                         <pension>       <XYZZYXDINCOME>        <amount/>
>                             <pctOfSBenefit/>        <startAge/>
>                             <stopAge/>        <rate/>
>                         </XYZZYXDINCOME>      </pension>      <other>
>                             <XYZZYXDINCOME>        <amount/>
> 
> I would have expected something more like:
> 
> ...
>               <client1>
>                     <CLIENT>
>                         <birth/>
>                         <xyzzyxAge/>
>                         <lifeExp/>
>                         <sSecurity>
>                             <XYZZYXDINCOME>
>                                 <amount/>
>                                 <pctOfSBenefit/>
>                                 <startAge/>
>                                 <stopAge/>
>                                 <rate/>
>                             </XYZZYXDINCOME>
>                         </sSecurity>
>                         <pension>
>                             <XYZZYXDINCOME>
>                                 <amount/>
>                                 <pctOfSBenefit/>
>                                 <startAge/>
>                                 <stopAge/>
>                                 <rate/>
>                             </XYZZYXDINCOME>
>                         </pension>
>                         <other>
>                             <XYZZYXDINCOME>
>                                 <amount/>
> 
> Do the serializers just do a different kind of indentation than
> I expect?
> 
> Is indentation not fully implemented yet?
> 
> Is there a bug?
> 
> Am I using OutputFormat incorrectly?
> 
> Here's how I create my OutputFormat object:
> 
>         OutputFormat fmt = new OutputFormat();
>         fmt.setIndenting( true );
>         fmt.setMethod( "xml" );
> 
> (That is, I don't set anything else.)
> 
> Thanks,
> 
> Daniel
> 
> --
> Daniel Barclay
> Digital Focus
> Daniel.Barclay@digitalfocus.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

-- 
----------------------------------------------------------------------
Assaf Arkin                                           www.exoffice.com
CTO, Exoffice Technologies, Inc.                        www.exolab.org