Hi Michael,
Have you tried Douglas Kvidera's suggestion: http://castor.exolab.org/list-archive/msg19709.html --Keith [EMAIL PROTECTED] wrote: > > Hi! > > I'm still waiting for any kind of response about this... > > Keith & Everyone, > > Can you confirm my assumption about the possible reason of the problem. > Or do you have another idea about this? > > Thanks... > > Hi Keith, > > i already tried with Xerces 1.3, 1.4 and 2.x. > Unfortunately, it's always the same problem... > > I think that I've found the possible reason of and solution to my problem by > looking at the code for the unmarshal process. (see "Unmarshaller.unmarshal" > mentioned below) Castor still use the deprecated interfaces for SAX1 > ("Parser" > and "DocumentHandler"). This interfaces has been replaced by the SAX2 > "XMLReader" > interface and "ContentHandler" interface (since Xerces 1.3). > > Please see also the attached test application mentioned below. It works > perfect on OS/390-USS. > > Michael > > ---------------------------------------------------------------------------- > ----------------- > /** > * Unmarshals Objects of this Unmarshaller's Class type. > * ... > **/ > public Object unmarshal(InputSource source) > throws MarshalException, ValidationException > { > Parser parser = Configuration.getParser(); > > if (parser == null) > throw new MarshalException("unable to create parser"); > > if (entityResolver != null) > parser.setEntityResolver(entityResolver); > > UnmarshalHandler handler = createHandler(); > parser.setDocumentHandler(handler); > parser.setErrorHandler(handler); > > try { > parser.parse(source); > } > catch(java.io.IOException ioe) { > throw new MarshalException(ioe); > } > catch(org.xml.sax.SAXException sx) { > Exception except = sx.getException(); > if (except == null) except = sx; > MarshalException marshalEx = new MarshalException(except); > if ( handler.getDocumentLocator() != null ) { > FileLocation location = new FileLocation(); > > location.setFilename(handler.getDocumentLocator().getSystemId()); > > location.setLineNumber(handler.getDocumentLocator().getLineNumber()); > > location.setColumnNumber(handler.getDocumentLocator().getColumnNumber()); > marshalEx.setLocation(location); > } > throw marshalEx; > } > > return handler.getObject(); > } //-- unmarshal(InputSource) > > ---------------------------------------------------------------------------- > ----------------- > > /** > * Test application (using SAX2 "XMLReader" interface and "ContentHandler" > interface) > * ... > **/ > package com.pass.test.xml; > > import java.io.IOException; > import org.xml.sax.XMLReader; > import org.xml.sax.Attributes; > import org.xml.sax.SAXException; > import org.xml.sax.helpers.DefaultHandler; > import org.xml.sax.helpers.XMLReaderFactory; > import org.apache.xerces.parsers.SAXParser; > > public class SAXTest extends DefaultHandler > { > public static void main(String[] argv) > { > if (argv.length != 1) > { > System.out.println("Usage: java SAXTest [URI]"); > System.exit(0); > } > String uri = argv[0]; > try > { > XMLReader parser = > XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); > SAXTest SAXTestInstance = new SAXTest(); > parser.setContentHandler(SAXTestInstance); > parser.parse(uri); > } > catch(IOException ioe) > { > ioe.printStackTrace(); > } > catch(SAXException saxe) > { > saxe.printStackTrace(); > } > } > public void startElement(String uri, String localName, String qName, > Attributes attributes) throws SAXException > { > System.out.println( "Start Element"+uri+" - "+localName ); > } > } > ---------------------------------------------------------------------------- > ---------------------------------- > > -----Urspr�ngliche Nachricht----- > Von: Keith Visco [mailto:[EMAIL PROTECTED]] > Gesendet: Freitag, 13. September 2002 18:41 > An: [EMAIL PROTECTED] > Betreff: Re: [castor-dev] Castor on OS/390-USS => "An invalid XML > character (Unicode: 0x14)was found..." > > Michael, > > It looks like a Xerces issue, have you tried using the verion of Xerces > that we bundle with Castor, version 1.4.0? > > Thanks, > > --Keith > > [EMAIL PROTECTED] wrote: > > > > Hi all, > > > > Currently i'm engaged in a project that involves Castor and OpenJMS. I > have > > few questions > > regarding the processing of XML documents. So it would be great if anybody > > could help me. > > > > I'm using Castor and OpenJMS on IBM OS/390 with UNIX System Services > active. > > > > W3C (and IBM, too) recommends that xml documents intended for use on other > > platforms > > be encoded in Unicode (UTF-8 or UTF-16 or US ASCII). I did some tests with > > Unicode or ASCII > > encoded XML documents on OS/390-USS, using only SAX or DOM (covered in > > "xerces-J_1.3.1.jar"). > > Everything works fine... > > > > Also I wrote a little test application which use the castor processing of > > xml documents (please see the > > attached java files "CTestReader.java" + "CBean.java", xml file "Cout.xml" > > and castor mapping file "Cmapping.xml"). > > Running this application on OS/390-USS, i get the following error: "An > > invalid XML character (Unicode: 0x14) was found..." > > (please see detailed error message mentioned below) > > > > I did a lot of tests, and lately it seems that the unmarshal process does > > not work properly on OS/390-USS. > > The only way to process xml documents with castor is to convert the file > to > > EBCDIC. It's also necessary to > > remove all linefeeds. Because, the xml specification does not define NEL > > (New Line or Next Line) as > > acceptable. > > > > A possible workaround is to convert all needed files in EBCDIC. However, > > this is not really a good solution > > because the truly portable encoding is Unicode... > > By the way, OpenJms use Castor to load some xml configuration files during > > startup. Therefore the > > current distribution of OpemJms does'nt work on OS/390-USS, too. I had to > > convert three xml files to > > EBCDIC (without NEL). Now it works fine on OS/390. But it's still only a > > workaround..! > > > > Do you have any ideas about the problem..? > > > > Many thanks in advance! > > > > Regards > > Michael Heilmann > > > > > /************************************************************************** > > /** CTestReader.java > > > /************************************************************************** > > import java.io.*; > > import org.exolab.castor.mapping.*; > > import org.exolab.castor.xml.*; > > > > public class CTestReader > > { > > public static void main(String[] argv) > > { > > try > > { > > Mapping map = new Mapping(); > > map.loadMapping("Cmapping.xml"); > > File file = new File("Cout.xml"); > > > > // now restore the value and list what we get > > Reader reader = new FileReader(file); > > Unmarshaller unmarshaller = new Unmarshaller(map); > > CBean read = (CBean)unmarshaller.unmarshal (reader); > > > > System.out.println(read.getCarrier()); > > System.out.println(read.getNumber()); > > } > > catch (IOException ex) > > { > > ex.printStackTrace(System.err); > > } > > catch (MarshalException ex) > > { > > ex.printStackTrace(System.err); > > } > > catch (ValidationException ex) > > { > > ex.printStackTrace(System.err); > > } > > catch (MappingException ex) > > { > > ex.printStackTrace(System.err); > > } > > } > > } > > > > > /************************************************************************** > > /** CBean.java > > > /************************************************************************** > > public class CBean > > { > > private String m_carrier; > > private int m_number; > > > > public CBean() {} > > public void setCarrier(String carrier) { > > m_carrier = carrier; > > } > > public String getCarrier() { > > return m_carrier; > > } > > public void setNumber(int number) { > > m_number = number; > > } > > public int getNumber() { > > return m_number; > > } > > } > > > > > /************************************************************************** > > /** Cout.xml > > > /************************************************************************** > > <?xml version="1.0" ?> > > <flight> > > <carrier>AR</carrier> > > <number>426</number> > > </flight> > > > > > /************************************************************************** > > /** Cmapping.xml > > > /************************************************************************** > > <!DOCTYPE databases PUBLIC > > "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" > > "http://castor.exolab.org/mapping.dtd"> > > <mapping> > > <description>Basic mapping example</description> > > <class name="CBean" auto-complete="true"> > > <map-to xml="flight"/> > > <field name="carrier"> > > <bind-xml name="carrier" node="element"/> > > </field> > > <field name="number"> > > <bind-xml name="number" node="element"/> > > </field> > > </class> > > </mapping> > > > > +++++++++++++++++++++++++++++++++++++++++++++++++ > > ++++ detailed error message > > +++++++++++++++++++++++++++++++++++++++++++++++++ > > CEE5206S The signal SIGINT was received. > > > > XACGPEP@ALAO:/xuser/xacgpep/pass/ctest$ java -cp > > castor-0.9.3.19.jar.jar:xerces-J_1.3.1.jar:. CTestReader > > org.xml.sax.SAXException: Parsing Error : An invalid XML character > (Unicode: > > 0x14) was found in the prolog of the document. > > Line : 1 > > Column : 2 > > > > at org.exolab.castor.xml.UnmarshalHandler.fatalError(Unknown > Source) > > at > > org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1096) > > at > > > org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocume > > ntScanner.java:644) > > at > > > org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.dispatch(XM > > LDocumentScanner.java:799) > > at > > > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner. > > java(Compiled Code)) > > at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952) > > at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source) > > at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source) > > at CTestReader.main(CTestReader.java:29) > > > > Diese E-Mail enth�lt vertrauliche und/oder rechtlich gesch�tzte > > Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail > > irrt�mlich erhalten haben, informieren Sie bitte sofort den Absender und > > vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte > > Weitergabe dieser Mail ist nicht gestattet. > > > > This e-mail may contain confidential and/or privileged information. If you > > are not the intended recipient (or have received this e-mail in error) > > please notify the sender immediately and destroy this e-mail. Any > > unauthorized copying, disclosure or distribution of the material in this > > e-mail is strictly forbidden. > > > > ----------------------------------------------------------- > > 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 > > Diese E-Mail enth�lt vertrauliche und/oder rechtlich gesch�tzte > Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail > irrt�mlich erhalten haben, informieren Sie bitte sofort den Absender und > vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte > Weitergabe dieser Mail ist nicht gestattet. > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and destroy this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > ----------------------------------------------------------- > 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
