UTF encoding not always properly detected -> Content is not allowed in prolog
error
-----------------------------------------------------------------------------------
Key: XERCESJ-1367
URL: https://issues.apache.org/jira/browse/XERCESJ-1367
Project: Xerces2-J
Issue Type: Bug
Components: Other
Affects Versions: 2.9.1
Environment: Using Castor XML schema source generator on URL
http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/Invoice.xsd
It has several includes, some with UTF-8 and others with UTF-16
Reporter: Sander Postma
I was getting "Content is not allowed in prolog" errors like described here:
http://www.mail-archive.com/[email protected]/msg00657.html
After a debug session I found out the input stream encoding was not detected.
It was on my primary document, but not on the includes.
A simple // was enough to fix the problem for me. Please see the row marked
below --------->
org.apache.xerces.impl.XMLEntityManager:
public String setupCurrentEntity(String name, XMLInputSource xmlInputSource,
boolean literal, boolean isExternal)
throws IOException, XNIException {
// get information
final String publicId = xmlInputSource.getPublicId();
String literalSystemId = xmlInputSource.getSystemId();
String baseSystemId = xmlInputSource.getBaseSystemId();
String encoding = xmlInputSource.getEncoding();
final boolean encodingExternallySpecified = (encoding != null);
Boolean isBigEndian = null;
fTempByteBuffer = null;
// create reader
InputStream stream = null;
---------> Reader reader = null; // xmlInputSource.getCharacterStream();
// First chance checking strict URI
String expandedSystemId = expandSystemId(literalSystemId, baseSystemId,
fStrictURI);
if (baseSystemId == null) {
baseSystemId = expandedSystemId;
}
if (reader == null) {
stream = xmlInputSource.getByteStream();
if (stream == null) {
...
...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]