Search in sources :

Example 1 with CanonicalizeFilter

use of nl.nn.adapterframework.xml.CanonicalizeFilter in project iaf by ibissource.

the class XmlUtils method canonicalize.

public static String canonicalize(String input) throws IOException {
    XmlWriter xmlWriter = new XmlWriter();
    xmlWriter.setIncludeComments(false);
    ContentHandler handler = new PrettyPrintFilter(xmlWriter);
    handler = new CanonicalizeFilter(handler);
    try {
        XmlUtils.parseXml(input, handler);
        return xmlWriter.toString();
    } catch (SAXException e) {
        throw new IOException("ERROR: could not canonicalize [" + input + "]", e);
    }
}
Also used : CanonicalizeFilter(nl.nn.adapterframework.xml.CanonicalizeFilter) IOException(java.io.IOException) XmlWriter(nl.nn.adapterframework.xml.XmlWriter) XmlValidatorContentHandler(nl.nn.adapterframework.validation.XmlValidatorContentHandler) ContentHandler(org.xml.sax.ContentHandler) PrettyPrintFilter(nl.nn.adapterframework.xml.PrettyPrintFilter) SAXException(org.xml.sax.SAXException)

Aggregations

IOException (java.io.IOException)1 XmlValidatorContentHandler (nl.nn.adapterframework.validation.XmlValidatorContentHandler)1 CanonicalizeFilter (nl.nn.adapterframework.xml.CanonicalizeFilter)1 PrettyPrintFilter (nl.nn.adapterframework.xml.PrettyPrintFilter)1 XmlWriter (nl.nn.adapterframework.xml.XmlWriter)1 ContentHandler (org.xml.sax.ContentHandler)1 SAXException (org.xml.sax.SAXException)1