0

In my xml document , doctype is present. While parsing the xml document using Apache Axiom , it throws an following error msg "org.apache.axiom.om.OMException: Cannot create OMDocType because the XMLStreamReader doesn't support the DTDReader extension".

   XMLStreamReader parser = null;
  try {
    StAXParserConfiguration standalone = StAXParserConfiguration.STANDALONE;
   parser= StAXUtils.createXMLStreamReader(standalone, in);
   // parser = XMLInputFactory.newInstance().createXMLStreamReader(in);
  }
  catch (XMLStreamException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  catch (FactoryConfigurationError e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  StAXOMBuilder builder=new StAXOMBuilder(parser);
  OMElement rootOMElement = builder.getDocumentElement();
V_Dev
  • 83
  • 6
  • Removing the doctype from the document will resolve this problem . But i want Axiom parser to take care this. – V_Dev Nov 04 '15 at 04:29

1 Answers1

1

This will be fixed in Axiom 1.2.16 (see AXIOM-475). In the meantime you can work around this issue by using Woodstox (4.0 or above) as StAX implementation.

Andreas Veithen
  • 8,868
  • 3
  • 25
  • 28
  • Hi Andreas, It seems you have resolved this issue. Could you please provide an example code. – V_Dev May 26 '16 at 13:39