use of com.helger.xml.sax.EmptyEntityResolver in project ph-commons by phax.
the class MicroReaderTest method testReadEntity.
@Test
public void testReadEntity() {
// Read file with notation
final IMicroDocument doc = MicroReader.readMicroXML(new ClassPathResource("xml/xml-entity-public.xml"), new SAXReaderSettings().setEntityResolver(new EmptyEntityResolver()));
assertNotNull(doc);
final MicroSAXHandler aHdl = new MicroSAXHandler(true, new EmptyEntityResolver(), true);
final ISAXReaderSettings aSettings = new SAXReaderSettings().setEntityResolver(aHdl).setDTDHandler(aHdl).setContentHandler(aHdl).setErrorHandler(aHdl).setLexicalHandler(aHdl);
assertTrue(SAXReader.readXMLSAX(InputSourceFactory.create(ClassPathResource.getInputStream("xml/xml-entity-public.xml")), aSettings).isSuccess());
assertNotNull(aHdl.getDocument());
// Write again
assertNotNull(MicroWriter.getNodeAsString(doc));
}
Aggregations