hello,

I have a problem that looks like it is a bug in Xerces. Is this something
that I should create a bug report of
or is this already a known bug?
--------------------
I use SAX to validate my XML-file.

org.xml.sax.XMLReader xmlReader;
..
some setting up
..

xmlReader = new SAXParser();
  linkResolver = new LinkResolver();
  xmlReader.setContentHandler(linkResolver);
  EntityResolver er = new ContentEntityResolver();
  xmlReader.setEntityResolver(er);

....
And here is the command that fails if the xml-file is in UTF-8 and starts
with a Byte-Order-Mar (BOM)

...........

xmlReader.parse(new InputSource(getContentReader(filename)));

-----------------------------
The following exception is thrown and there is only the BOM


[Fatal Error] :1:1: Content is not allowed in prolog.
com.nokia.vira.rs.services.content.validation.InvalidBlockException: Initial
Block content is invalid:
X:/embu/data/test/selectedBlocks-s90-es/noSpecialChars.vsbl
 at
com.nokia.vira.rs.services.content.validation.ContentValidator.validateBlock
(ContentValidator.java:147)
 at
com.nokia.vira.rs.services.content.validation.ContentValidator.main(ContentV
alidator.java:327)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at
com.nokia.vira.rs.services.content.validation.ContentValidator.validateBlock
(ContentValidator.java:145)
 ... 1 more

If I remove the BOM with a binary editor the file is validated.

----------------

Xerces seems to manage BOM in at least two places ie.
org\apache\xerces\xinclude\XIncludeTextReader.java
org\apache\xerces\impl\XMLEntityManager.java

but the SAX parser does not use these.

I have located the problem into method dispatch of private class
PrologDispatcher
in org.apache.xerces.imlp.XmlDocumentScannerImpl.java

It seems that the intention is to skip leading spaces but also that fails.
That might eb
the right place for a BOM fix too?

regards
Kaarle Kaila

--
Kaarle Kaila
email: kaarle dot kaila at iki dot fi
www.iki.fi/kaila



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to