Hello
        Can't say for sure.... need some tests here

Can you try to mashal/unmarshal in the same class or method code,  to
see if it is castor's fault that the linefeed gets truncated?

Can you try to marshal/unmarshal between layers, to see if the code is
correct?

Place where I would expect the linefeed to disapper is between your
webapp java code and the JSP.... for some reasons (wild guess, I don't
know) tomcat may trims it if the XML code is in the output stream..

Regards
        marco

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 05 November 2004 13:06
To: [EMAIL PROTECTED]
Subject: Re: [castor-user] Marshalling linefeeds

Hi, Marco.

In that application xml documents are passed between different modules
as java.lang.String instances held in the HttpSession. Sometimes they
are used with stylesheet processing to output HTML. Do not ask about
sense here. It's just that and I won't be able to change it in the short
run.

So in the scenario I look at Castor XML is used to ease XML document
modification held in strings.
My problem is that the string looses the linefeed character that I'd
like to be included. I checked by using log4j to output the bean's
properties before and after marshalling (that is ok) and the generated
XML String.

As it appears only within the webapp, I upgraded from Tomcat 4.1.30 to
Tomcat 5.0.28, but I get the same result. So apparently it is not tied
to one specific version of Xerces or Xalan or Tomcat.

Do you have an idea what's worth looking at?

Hiran


> -----Original Message-----
> From: Marco Mistroni [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 05, 2004 11:56 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-user] Marshalling linefeeds
> 
> 
> Hello there,
>       Might be a silly question,but I suppose you have tried to create
> your
> Object, and then marshal it to a string via Castor (and output the
> result), correct?
> And if I understand correctly, steps above in a standalone application
> returns exactly what you want (a line feed..)
> 
> Then when you run it into tomcat, that line feed disappear. 
> Question: can you describe how are you using Castor inside tomcat?
> 
> Are you using it to pass XML strings to a webservice?
> Are you using it to pass XML strings to pages?
> 
> Where is the generated document? In your jsp? 
> 
> Regards
>       marco
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] 
> Sent: 05 November 2004 10:40
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-user] Marshalling linefeeds
> 
> Hi again.
> 
> Got no answer so far, but found out that a little application that
> isolates the problem works perfectly outside Tomcat. 
> Therefore it seems
> like the problem is introduced by something tomcat brings 
> with it. Will
> have to investigate further.
> 
> Hiran
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 03, 2004 11:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: [castor-user] Marshalling linefeeds
> > 
> > 
> > Hi there.
> > 
> > I have some java beans generated from an XML Schema.
> > Whenever I set a string property to a value that contains 
> > linefeeds, the generated XML document contains no linefeeds, 
> > thus giving me the wrong value after unmarshalling.
> > 
> > Code looks like this:
> > 
> > Service service = new Service();
> > service.setDescription("First line\nSecond line");
> > StringWriter sw = new StringWriter();
> > service.marshal(sw);
> > System.out.println(sw.toString());
> > 
> > Is there something I need to reconfigure?
> > 
> > Hiran
> > 
> > -----------------------------------------
> > Hiran Chaudhuri
> > SAG Systemhaus GmbH
> > Elsenheimer Stra�e 11
> > 80867 M�nchen
> > Phone +49-89-54 74 21 34
> > Fax   +49-89-54 74 21 99
> > 
> > 
> 
> 

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

Reply via email to