use of org.apache.axiom.core.stream.dom.DOMInput 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);
}
use of org.apache.axiom.core.stream.dom.DOMInput in project webservices-axiom by apache.
the class StAXPivotTransformerTest method runTest.
@Override
protected void runTest() throws Throwable {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setExpandEntityReferences(false);
factory.setCoalescing(true);
factory.setIgnoringComments(true);
Document document = factory.newDocumentBuilder().parse(sample.getUrl().toString());
StAXPivot pivot = new StAXPivot(null);
pivot.setReader(new DOMInput(document, false).createReader(pivot));
StringWriter sw = new StringWriter();
xsltImplementation.newTransformerFactory().newTransformer().transform(new StAXSource(pivot), new StreamResult(sw));
assertAbout(xml()).that(sw.toString()).hasSameContentAs(document);
}
use of org.apache.axiom.core.stream.dom.DOMInput in project webservices-axiom by apache.
the class StAXPivotTest method setUp.
@Before
public void setUp() throws Exception {
Document document = DOMImplementation.XERCES.newDocument();
Element element = document.createElementNS("urn:test", "p:test");
document.appendChild(element);
element.appendChild(document.createEntityReference("ent"));
pivot = new StAXPivot(null);
pivot.setReader(new DOMInput(document, false).createReader(pivot));
}
Aggregations