Thanks for the response. I am actually parsing UTF-16 encoded schemas provided by Microsoft for MS Word files. I am able to do it successfully using JAXB, which successfully parses the UTF-16 encoded schemas and generates the Java binding for the schema.
I have a preference for Castor and would like to use Castor instead of JAXB, but am not able to parse the schemas for generating the java binding because I keep getting the exception I have mentioned. Can you help me resolve this issue? I could send you a zip file containing the schemas if that will help. I don't need help in generating the complete Java binding for the schema, which will require effort in resolving naming conflicts for elements, etc. I just need help in resolving this basic issue/exception I get whenever I try to run the castor code generator on the schemas. Thanks and regards, Shubh ________________________________________ From: Werner Guttmann [[email protected]] Sent: Sunday, January 04, 2009 1:09 PM To: [email protected] Subject: Re: [castor-user] Problem with using SourceGeneratorMain for xml schemas with utf-16 encoding Hi, as already mentioned off-line, I do not think this is a problem with Castor. Have a look at the stack trace (copied partially) org.exolab.castor.xml.schema.reader.Sax2ComponentReader.fatalError(Sax2ComponentReader.java:296) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) and you'll notice that is it Xerces itself reporting a fatal error. Without having seen the XML schema in question, it looks like you might have set the encoding in the XML declaration, but the document itself is NOT UTF-16 encoded. Regards Werner shubh singh wrote: > Hi, > > I am having trouble using SourceGeneratorMain with XML schemas that have an > encoding of UTF-16. Whenever the declaration at the top of the XML schema > file is <?xml version="1.0" encoding="UTF-16" ?>, I get the following error > when running SourceGeneratorMain: > > org.xml.sax.SAXException: In document: > 'file:///C:/Documents%20and%20Settings/Castor/test/word/new.xsd' > Parsing Error : Content is not allowed in prolog. > Line : 1 > Column : 1 > at > org.exolab.castor.xml.schema.reader.Sax2ComponentReader.fatalError(Sax2ComponentReader.java:296) > at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) > at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) > at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) > at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) > at > org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown > Source) > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) > at > org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:658) > at > org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:593) > at > org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:312) > > I would really appreciate your help with the above problem. > > Thanks and regards, > > Shubh > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [v.E.1] --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

