Search in sources :

Example 61 with DOMResult

use of javax.xml.transform.dom.DOMResult in project ddf by codice.

the class SchematronValidationService method performStage.

private DOMResult performStage(Source input, URL preprocessorUrl) throws TransformerException, ParserConfigurationException, SchematronInitializationException {
    Source preprocessorSource = new StreamSource(preprocessorUrl.toString());
    // Initialize container for warnings we may receive during transformation of input
    warnings = new Vector<>();
    Transformer transformer = transformerFactory.newTransformer(preprocessorSource);
    // Setup an error listener to catch warnings and errors generated during transformation
    transformer.setErrorListener(new Listener());
    // Transform the input using the preprocessor's transformer, capturing the output in a DOM
    DOMResult domResult = new DOMResult();
    transformer.transform(input, domResult);
    return domResult;
}
Also used : Transformer(javax.xml.transform.Transformer) ErrorListener(javax.xml.transform.ErrorListener) DOMResult(javax.xml.transform.dom.DOMResult) StreamSource(javax.xml.transform.stream.StreamSource) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) InputSource(org.xml.sax.InputSource) SAXSource(javax.xml.transform.sax.SAXSource)

Aggregations

DOMResult (javax.xml.transform.dom.DOMResult)61 Document (org.w3c.dom.Document)33 DOMSource (javax.xml.transform.dom.DOMSource)24 Transformer (javax.xml.transform.Transformer)20 DocumentBuilder (javax.xml.parsers.DocumentBuilder)17 TransformerException (javax.xml.transform.TransformerException)14 IOException (java.io.IOException)13 InputSource (org.xml.sax.InputSource)13 StreamSource (javax.xml.transform.stream.StreamSource)12 StringReader (java.io.StringReader)11 SAXResult (javax.xml.transform.sax.SAXResult)10 Element (org.w3c.dom.Element)10 Node (org.w3c.dom.Node)10 SAXSource (javax.xml.transform.sax.SAXSource)9 StreamResult (javax.xml.transform.stream.StreamResult)9 Test (org.junit.Test)9 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)8 Source (javax.xml.transform.Source)8 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)7 InputStream (java.io.InputStream)6