use of org.apache.axiom.core.stream.XmlReader in project webservices-axiom by apache.
the class SerializerConformanceTest method runTest.
@Override
protected void runTest() throws Throwable {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setExpandEntityReferences(false);
Document document = factory.newDocumentBuilder().parse(sample.getUrl().toString());
StringWriter sw = new StringWriter();
XmlReader reader = new DOMInput(document, false).createReader(new Serializer(sw));
while (!reader.proceed()) {
// Just loop
}
InputSource is = new InputSource(new StringReader(sw.toString()));
is.setSystemId(sample.getUrl().toString());
assertAbout(xml()).that(is).ignoringWhitespaceInPrologAndEpilog().treatingElementContentWhitespaceAsText().hasSameContentAs(document);
}
Aggregations