This looks like an error from your sax parser (or whichever XML parser you're using). To locate the error, try adding an ErrorHandler to xml handling. For instance, for a DocumentBuilder, you can can call setErrorHandler():
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
@Override
public void warning(SAXParseException exception) throws SAXException {
System.err.println("warning: caught exception");
exception.printStackTrace(System.err);
}
@Override
public void fatalError(SAXParseException exception) throws SAXException {
System.err.println("fatalError: caught exception");
exception.printStackTrace(System.err);
}
@Override
public void error(SAXParseException exception) throws SAXException {
System.err.println("error: caught exception");
exception.printStackTrace(System.err);
}
});
This will give you a better clue about what is happening.
For more information, look at com.sun.org.apache.xerces.internal.util.DefaultErrorHandler#fatalError, which is I believe what is creating this error message.
EDIT: With the stacktrace, and the extra code, it looks like either:
xml
is emptyxml
has a different encoding from the one you've specified in the XML.
To verify 2, does your XML contains non-ascii characters, or does the XML have a correct declaration with the correct encoding, for instance:
<?xml version="1.0" encoding="us-ascii"?>
<?xml version="1.0" encoding="windows-1252"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-16"?>