PushbackInputStream pis = new PushbackInputStream(inputStream);
byte[] buf = new byte[3];
pis.read(buf, 0, 3);
if (! (buf[0] == 0x00EF) && (buf[1] == 0x00BB) && (buf[2] == 0x00BF) ) {
pis.unread(buf, 0, 3);
}

I handle the inputstream before unmarshal,and it's ok now. Is there another
way to resolve this problem?



rain.xk wrote:
> 
> I think I find the problem .There are "EF BB BF" characters before the XML
> prolog,it's the BOM of the UTF-8.How can I resolve this problem without
> delete the "EF BB BF" characters?
> Can the Castor handle this?
> 
> 
> 
> Werner Guttmann-5 wrote:
>> 
>> Hi,
>> 
>> Looks like you have one or more 'invisible' characters before the XML
>> prolog, which as per specification is not allowed. Opening and saving it
>> again with your editor seems to be removing these characters. At least
>> that's what it appears to be ....
>> 
>> Regards
>> Werner 
>> 
>>> -----Original Message-----
>>> From: rain.xk [mailto:[EMAIL PROTECTED] 
>>> Sent: Donnerstag, 30. November 2006 05:50
>>> To: dev@castor.codehaus.org
>>> Subject: [castor-dev] Content is not allowed in prolog
>>> 
>>> 
>>> Hi, 
>>> 
>>> There is a problem when I unmarshal a xml file.
>>> The console print the error message:
>>> Content is not allowed in prolog.{file: [not available]; 
>>> line: 1; column: 1}
>>>     at 
>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:732)
>>>     at 
>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:588)
>>>     .....
>>> Caused by: org.xml.sax.SAXParseException: Content is not 
>>> allowed in prolog.
>>>     at
>>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExcep
>>> tion(Unknown
>>> Source)
>>>     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.scanDocu
>>> ment(Unknown
>>> Source)
>>>     at 
>>> org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>>     at 
>>> org.apache.xerces.parsers.DTDConfiguration.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:718)
>>>     ... 44 more
>>> But,after I open the file with EditPlus(just a editer) and 
>>> save with no change,I unmarshal the xml file again.
>>> There is no problem ,everything is ok!
>>> First, I think the problem is something about BOM,but I have 
>>> been comparing the two files and there is nothing different! 
>>> They all have the FFFE3C00.
>>> Someone can tell me why and how to avoid this problem?
>>> 
>>> Regards
>>> Rain.Xu
>>> 
>>> --
>>> View this message in context: 
>>> http://www.nabble.com/Content-is-not-allowed-in-prolog-tf27296
>>> 88.html#a7613622
>>> Sent from the Castor - Dev mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list please visit:
>>> 
>>>     http://xircles.codehaus.org/manage_email
>>> 
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>> 
>>     http://xircles.codehaus.org/manage_email
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Content-is-not-allowed-in-prolog-tf2729688.html#a7672003
Sent from the Castor - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to