Hello Keith,
Thanks for your response. I've double-checked that the file is indeed
UTF-8, I went into Notepad and specifically saved the file as UTF-8
encoding. Using a hex editor, I see the EFBBBF in the beginning of
the file representing the BOM for UTF-8.
Are there properties that I need to set in xerces to make this work?
Or perhaps, you're using the Unmarshaller in a different way than I
am? I'm just using the auto-generated unmarshal method (see below).
I've tried passing a FileReader to read the xml file, and I've also
tried passing in an InputStreamReader with a FileInputStream and
specifying UTF-8 as the character set.
public static java.lang.Object unmarshal(java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
{
return
(org.eclipse.birt.data.oda.util.driverconfig.OpenDataAccessConfig)
Unmarshaller.unmarshal(org.eclipse.birt.data.oda.util.driverconfig.OpenDataAccessConfig.class,
reader);
} //-- java.lang.Object unmarshal(java.io.Reader)
Any insights would be appreciated.
On Fri, 07 Jan 2005 18:59:55 -0600, Keith Visco <[EMAIL PROTECTED]> wrote:
>
>
> 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
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user