Mike,

thank you, but sorry, no change.
My problem is to
- turn off automatic line breaking *and*
- preserve line breaks that exist in the text content

Seems difficult, I wonder if this is really such an uncommon cause...

Heiko Erhardt
skynamics AG
www.skynamics.com




> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 10:47 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Old topic back again: XML: Line breaks in
> indent mode
> 
> 
> 
> Hello Heiko,
> 
> I was able to achieve unbroken lines by instantiating the OutputFormat
> object, as in:
> 
>     OutputFormat of = org.exolab.castor.util.Configuration.getOutputFormat
> ();
> 
> where use of the getOutputFormat() method helped create the OutputFormat of
> object.
> 
> Perhaps you haven't been picking up the *real* of object, by way of your
> line,
>   OutputFormat of = new OutputFormat ();
> 
>  I hope this helps - !
> 
> ..Mike Sanderson
> 
> 
> 
> 
>                                                                                      
>     
>             
>                     "Heiko Erhardt"                                                  
>     
>             
>                     <h.erhardt@skyn       To:     [EMAIL PROTECTED]              
>     
>             
>                     amics.com>            cc:                                        
>     
>             
>                                           Subject:     [castor-dev] Old topic back 
>again: 
> XML: Line   
>                     09/19/2002             breaks in indent mode                     
>     
>             
>                     01:04 PM                                                         
>     
>             
>                     Please respond                                                   
>     
>             
>                     to castor-dev                                                    
>     
>             
>                                                                                      
>     
>             
>                                                                                      
>     
>             
> 
> 
> 
> 
> Sorry to pick this up again, but getting the xml serializer to do
> what I want doesn't seem to be easy.
> xml output should be indented, however, newlines in text content
> should be preserved.
> 
>      OutputFormat of = new OutputFormat ();
> 
>      of.setPreserveSpace (true);
>      of.setIndenting (true);
>      of.setIndent (indent);
> 
>      // As large as needed to prevent auto-linebreaks in text nodes
>      of.setLineWidth (20000);
> 
>      XMLSerializer serializer = new XMLSerializer (osw, of);
>      Marshaller marshaller = new Marshaller (serializer.asContentHandler
> ());
>      ...
> 
> Using the above code, newlines remain, but there is no indentation.
> Setting preserveSpace to false gets back the indentation, but
> removes the newlines. Tried a lot of things, no avail.
> 
> I know this is not Castor-specific, but does anybody have an idea?
> 
> Heiko Erhardt
> skynamics AG
> www.skynamics.com
> 
> 
> 
> 
> > -----Original Message-----
> > From: Bart Guijt [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 07, 2002 3:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [castor-dev] XML: Link breaks in indent mode
> >
> >
> > Hi Xavier,
> >
> > The Marshaller using a ContentHandler is introduced in the latest Castor
> > release: 0.9.3.19. The DocumentHandler should work too, but is deprecated
> in
> > the latest XML parser API's.
> >
> > If you have problems preserving the whitespace characters, perhaps you
> > should tweak the OutputFormat settings a little bit. The original poster
> > requested output _without_ linebreaks, so that's exactly what is
> happening!
> >
> > BG
> >
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, June 07, 2002 11:00 AM
> > Subject: Re: [castor-dev] XML: Link breaks in indent mode
> >
> >
> > >
> > > Hi Bart,
> > >
> > >     I tried your code, but I have some troubles with it :
> > > the method Marshaller.marshal() doesn't expect a ContentHandler as your
> > > code do, but it seems (in the doc) that it expects a DocumentHandler,
> so i
> > do :
> > >
> > >             OutputFormat of = new OutputFormat();
> > >             of.setIndenting( true );
> > >             of.setIndent( 2 );  // 2-space indention
> > >             of.setLineWidth( 16384 );  // As large as needed to prevent
> > > linebreaks in text nodes
> > >
> > >             XMLSerializer serializer = new XMLSerializer( myFileWriter,
> > of );
> > >             m.marshal(des, serializer.asDocumentHandler());
> > >
> > > the output file is well indented, but my strings (xml-space="preserve")
> > are
> > > still losing line breaks !!!
> > > I probably did something wrong...
> > >
> > > thanks in advance.
> > >
> > > [EMAIL PROTECTED]
> > > OS/S/II   ~  Bureau F3040
> > > Tel : +33 (0)5.34.35.60.23
> > > Fax : +33 (0)5.34.35.61.63
> > >
> > >
> > > ALCATEL SPACE INDUSTRIES
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >    unsubscribe castor-dev
> >
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>      unsubscribe castor-dev
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev
> 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to