Recently I found a work around for this problem, so wanted to share this across.
1. Replace xercesImpl.jar with sax.jar from http://www.saxproject.org 2. Upgrade castor-1.0.2.jar to castor-1.2.jar 3. Configure the castor jar using a castor.properties file with following content: ########################################################## # Define the XML parser to be used by Castor. # The parser must implement org.xml.sax.Parser. org.exolab.castor.parser=org.xml.sax.helpers.XMLReaderAdapter # Defines the (default) XML serializer factory to use by Castor, which must # implement org.exolab.castor.xml.SerializerFactory; default is # org.exolab.castor.xml.XercesXMLSerializerFactory org.exolab.castor.xml.serializer.factory=org.exolab.castor.xml.XercesJDK5XML SerializerFactory ########################################################## Because, this relates to castor 1.0.2, which is not listed in the options while creating a Jira, I haven't filed an issue. Additionally, I don't have a unit test to provide for this, as that would be heavily dependent on my work project. Let me know, if I can provided any more details. Thanks. Mohit Raj -----Original Message----- From: Werner Guttmann [mailto:[email protected]] Sent: Wednesday, January 05, 2011 10:41 PM To: Mohit Raj Cc: [email protected] Subject: Re: [castor-user] Line breaks during Unmarshall process Hi, just to make sure that email does not fool around with characters, can you please create a new Jira issue and attach all relevant files so that we can replay this problem ? Thanks in advance Werner On 05.01.2011 15:45, Mohit Raj wrote: > Yes am sure the problem relates to unmarshalling. Below is an example and > also attached is the problem example. > > ========================================================= > Problem causing XML fragment: > <store>REGT# 1 1 1 148 90</store> > > Castor Unmarshaller bebug Output: > #startElement: store > #characters: REGT# > #characters: 1 1 1 148 90 > #endElement: store > ========================================================= > If you observe in the output above content of store element is being shown > in 2 lines (#characters) which is because of the fact that a new line > character is introduced. > > Pl. see the attached full XML document. Also, do ignore the 14111 character > position(mentioned in earlier in thread) as that was the position reported > of tab delimited file from which the attached XML has been generated. > > Thanks, > Mohit Raj > > -----Original Message----- > From: Werner Guttmann [mailto:[email protected]] > Sent: Wednesday, January 05, 2011 7:36 PM > To: [email protected] > Cc: Mohit Raj > Subject: Re: [castor-user] Line breaks during Unmarshall process > > Hi, > > I am not sure I can follow fully. Can you please provide us with some > sample XML to highlight the problem at hand ? And are you sure the > problem is a problem related to unmarshalling, i.e. producing Java > object instances from XML document(s) ? > > Cheers > Werner > > On 05.01.2011 12:36, Mohit Raj wrote: >> Hi, >> >> >> >> I have been looking around the web and specifically on Castor site but in >> vain. I am facing the problem of new line character being introduced when >> using the org.exolab.castor.xml.Unmarshaller object. This happenes exactly >> when the character 14111 in the xml to be imported and converted to java >> objects has a white space on it. I have seen some suggestions like >> OutputFormat.setLineWidth(16384), but this method doesn't exist in my >> version of castor library (1.3 and 1.0.2), though at the same time, not > sure >> if this would be of any help, as am unmarshalling against this being a >> solution for marshalling. >> >> >> >> Any help would be highly appreciated and let me know if you require any > more >> details. >> >> >> >> Thanks, >> >> Mohit >> >> --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

