"Content Is Not Allowed In Prolog" When Parsing Perfectly Valid XML On GAE
Answer : The encoding in your XML and XSD (or DTD) are different. XML file header: <?xml version='1.0' encoding='utf-8'?> XSD file header: <?xml version='1.0' encoding='utf-16'?> Another possible scenario that causes this is when anything comes before the XML document type declaration. i.e you might have something like this in the buffer: helloworld<?xml version="1.0" encoding="utf-8"?> or even a space or special character. There are some special characters called byte order markers that could be in the buffer. Before passing the buffer to the Parser do this... String xml = "<?xml ..."; xml = xml.trim().replaceFirst("^([\\W]+)<","<"); This error message is always caused by the invalid XML content in the beginning element. For example, extra small dot “.” in the beginning of XML element. Any characters before the “ <?xml…. ” will cause above “ org.xml.sax.SAXParseExcept...