The error message you are reporting is coming from the parser that you are using (in this case Xerces) and not Castor. I've never had a problem with regards to UTF-8 encoded XML files using Castor with Xerces, so you may want to double check that the file is indeed a proper UTF-8 encoded XML document.

--Keith


Alan Li wrote:
Hello,

Why doesn't the castor generated unmarshal() method unmarshal xml
files that are saved specifically in UTF8 encoding?  Once I remove the
unicode marker at the beginning of the file, then it works.  Does this
mean the castor generated code can only support xml files saved as
ASCII?  Below is the stack trace for the problem I see.

Thanks.

Parsing Error : Content is not allowed in prolog.
Line : 1
Column : 1

org.xml.sax.SAXException: Parsing Error : Content is not allowed in prolog.
Line : 1
Column : 1

        at 
org.exolab.castor.xml.UnmarshalHandler.fatalError(UnmarshalHandler.java:2323)
        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.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748)



----------------------------------------------------------- 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

Reply via email to