Title: RE: [castor-user] carriage-return line feed not being unmarshalled in 0.9.6

Problem solved, many thanks.
I thought I had read the API properly (I think I was looking at the 0.9.5 where the method wasn't there, I promise to look more closely next time).

Regards

Mark


-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]]
Sent: Friday, 18 February 2005 2:54 PM
To: '[email protected]'
Subject: Re: [castor-user] carriage-return line feed not being
unmarshalled in 0.9.6



Hi Mark,

Carriage returns are normalized in XML to a single space, unless
otherwise specified. The whitespace handling in earlier versions of
Castor was flawed that it didn't always do this normalization.

Castor 0.9.6 should handle it properly.

If you want to preserve the whitespace characters try the following:

Unmarshaller unm = new Unmarshaller(...);
unm.setWhitespacePreserve(true);
..
Object myObject = unm.unmarshal(reader);

Hope that works for you.

--Keith


Mark Ziebell wrote:
> We recently upgraded to 0.9.6 and now it seems that the unmarshaller is
> removing 
\n
>
> In ver 0.9.5 we had xml of the form:
> <element>hello\r\nworld</element> and the \r\n was marshalled to &#xd;\n
> as per spec.
> Then when unmarshaled we once again had hello\r\nworld
>
> However in 0.9.6 the unmarhsalling produces hello world
> Code excerpt below
>
> So possibly some setting on the unmarshaller that I am missing?
> Also have xerces2.6.2 on path but this does not seem to be relevant.
>
> BTW, reverting to 0.9.5 is not an option.
>
> Regards
>
> Mark
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++
>
>             String _strRawXML ="<?xml version=\"1.0\"
> encoding=\"UTF-8\"?> " +
>                    "<person>" +
>                         "<ssn>222  -222-2222</ssn>" +
>                         "<address>123 Foo
> Street&#xd;\nWollongongCONTRIBUTION_ORDER_REFERENCE=123&#xd;\nTAX_DEDUCTION_AMOUNT_TYPE=A&#xd;\nTAX_DEDUCTION_AMOUNT=100000.00&#xd;</address>"

> +
>
>                         "<work-phone>(123) 123-1234</work-phone>" +
>                         "<home-phone>(123) 123-1234</home-phone>" +
>                         "<email>[EMAIL PROTECTED]</email>" +
>                         "<name>Bob _hello_ Harris</name>" +
>                     "</person>";
>             Unmarshaller unmarshaller = new Unmarshaller(Person.class);
>             unmarshaller.setClassLoader(Person.class.getClassLoader());
>             unmarshaller.setResolver(new
> ClassDescriptorResolverImpl(Person.class.getClassLoader()));
>             unmarshaller.setLogWriter(printWriter);
>             unmarshaller.setDebug(true);
>   
> //            Object obj1  =  unmarshaller.unmarshal(new InputSource(new
> FileReader(new File("bob_person.xml"))));
>             Object obj4  =  unmarshaller.unmarshal(new InputSource(new
> StringReader(_strRawXML.toString())));
>             Object obj5  =  unmarshaller.unmarshal(new InputSource(new
> InputStreamReader(new ByteArrayInputStream(_strRawXML.getBytes()))));
>
>             System.out.println("Person unmarshalled");
>
> Important notice: This message is intended for the individual(s) and
> entity(s) addressed. The information contained in this transmission and
> any attached, may be confidential and may also be the subject of legal
> privilege, public interest immunity or legal professional privilege. Any
> review, retransmission, dissemination or other use of, taking of any
> action in reliance upon this information by person or entities other
> than the recipient is prohibited and requires authorization from the
> sender. If you are not the addressee indicated in this message (or
> responsible for delivery of the message to such person) you may not copy
> or deliver this message to anyone. In such cases you should destroy this
> message and kindly notify the sender by reply email.
>
> WARNING: Although Infocomp has taken reasonable precautions so that no
> viruses are present in this e-mail, the company cannot accept
> responsibility for any loss or damage arising from the use of e-mail
> attachments.
>
>
> ------------------------------------------------------------------------
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



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

Important notice: This message is intended for the individual(s) and entity(s) addressed. The information contained in this transmission and any attached, may be confidential and may also be the subject of legal privilege, public interest immunity or legal professional privilege. Any review, retransmission, dissemination or other use of, taking of any action in reliance upon this information by person or entities other than the recipient is prohibited and requires authorization from the sender. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person) you may not copy or deliver this message to anyone. In such cases you should destroy this message and kindly notify the sender by reply email.

WARNING: Although Infocomp has taken reasonable precautions so that no viruses are present in this e-mail, the company cannot accept responsibility for any loss or damage arising from the use of e-mail attachments.

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

Reply via email to