0

I have tried all the answers related to this parse error but none worked. Here is the issue am facing: org.xml.sax,SAXParseException; lineNumber : 1 ; columnNumber: 1 ; Content is not allowed in prolong

SaxparserImpl.parse(unknown source)

Am using jaxp-api.jar, xml is retrieved from database and while parsing, it throws exception.

There is no extra characters or white space before the start of xml.

Jdk is 1.8

Issue resolved: since my project is related to migration, I have updated the ojdbc jar from ojdbc14 to ojdbc7. So, after retrieving xml type value from DB, in ojdbc14 OracleTypes.OPAQUE is used to convert xml to string. But in ojdbc7, OracleTypes.SQLXML is equivalent for conversion. Hence I have implemented accordingly and code worked happily. Thanks everyone for your valuable thoughts.

  • invisible characters may be? besides there is no code that you have shown here – Eugene Mar 14 '18 at 12:56
  • private static VsiXmlSaxParser parse (Class type, InputSource source) throws Exception { SAXParser parser = spf.newSAXParser(); VsiXmlSaxParser classInstance = (VsiXmlSaxParser) type.newInstance(); DefaultHandler handler = new VsiXmlSaxParser handler(classInstance); parser.parse(source, handler); return classInstance;} – Murali Dharan Mar 14 '18 at 13:00
  • How to check invisible characters ? – Murali Dharan Mar 14 '18 at 13:04
  • 1
    Using a debugger! – Stephen C Mar 14 '18 at 13:05
  • 1
    Please provide the XML you try to parse. Furthermore, please list what you have done to verify "all the answers related" to enable others to help you. – Lars Gendner Mar 14 '18 at 13:06
  • You might find some solutions here: https://stackoverflow.com/questions/3030903/content-is-not-allowed-in-prolog-when-parsing-perfectly-valid-xml-on-gae – Lars Gendner Mar 14 '18 at 13:07
  • It is almost certain that the first character of your XML file is not a `<` character. How do you check? Using a debugger would be one way. Set a breakpoint and check what you are passing to the parser. – Stephen C Mar 14 '18 at 13:08
  • Yes, I tried debugging it, but the object is oracle.xdb.XMLType. xml starts with – Murali Dharan Mar 14 '18 at 13:14
  • At one point , xml retrieved from database is converted to Oracle.xdb.XMLType from string – Murali Dharan Mar 14 '18 at 13:16
  • The same scenario works in jdk1.6 and jboss. But now, parsing not working in jdk8 and tomcat – Murali Dharan Mar 14 '18 at 14:35
  • 1
    I bet, it’s the `0xef 0xbb 0xbf` header that Windows uses to mark UTF-8 files. Some XML parsers ignore this non-standard thing, others strictly follow the rules… – Holger Mar 14 '18 at 15:22
  • Issue resolved: since my project is related to migration, I have updated the ojdbc jar from ojdbc14 to ojdbc7. So, after retrieving xml type value from DB, in ojdbc14 OracleTypes.OPAQUE is used to convert xml to string. But in ojdbc7, OracleTypes.SQLXML is equivalent for conversion. Hence I have implemented accordingly and code worked happily. Thanks everyone for your valuable thoughts. – Murali Dharan Mar 14 '18 at 17:58
  • Could you please add your solution as an answer to your question? – Lars Gendner Mar 15 '18 at 13:47

0 Answers0