在我的xml文档中,存在doctype。在使用Apache Axiom解析xml文档时,它会抛出以下错误消息“org.apache.axiom.om.OMException:无法创建OMDocType,因为XMLStreamReader不支持DTDReader扩展”。
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();