Search in sources :

Example 81 with DOMImplementation

use of org.w3c.dom.DOMImplementation in project knime-core by knime.

the class HistogramColumn method createSvgImageCell.

/**
 * @param histogramData A {@link HistogramModel}.
 * @return The SVG image cell.
 */
private DataCell createSvgImageCell(final HistogramModel<?> histogramData, final boolean paintLabels) {
    DOMImplementation domImpl = new SVGDOMImplementation();
    String svgNS = "http://www.w3.org/2000/svg";
    Document myFactory = domImpl.createDocument(svgNS, "svg", null);
    SVGGraphics2D g = new SVGGraphics2D(myFactory);
    g.setSVGCanvasSize(new Dimension(m_width, m_height));
    paint(histogramData, paintLabels, g);
    myFactory.replaceChild(g.getRoot(), myFactory.getDocumentElement());
    DataCell dc = new SvgCell((SVGDocument) myFactory);
    return dc;
}
Also used : SVGDOMImplementation(org.apache.batik.dom.svg.SVGDOMImplementation) DOMImplementation(org.w3c.dom.DOMImplementation) SVGDOMImplementation(org.apache.batik.dom.svg.SVGDOMImplementation) SVGGraphics2D(org.apache.batik.svggen.SVGGraphics2D) DataCell(org.knime.core.data.DataCell) SvgCell(org.knime.base.data.xml.SvgCell) Dimension(java.awt.Dimension) Document(org.w3c.dom.Document) SVGDocument(org.w3c.dom.svg.SVGDocument)

Example 82 with DOMImplementation

use of org.w3c.dom.DOMImplementation in project Payara by payara.

the class CombinedXPath method writeXML.

private static synchronized void writeXML(final Node node, final Writer writer) {
    try {
        if (lsSerializer == null) {
            final DOMImplementation domImpl = DOMImplementationRegistry.newInstance().getDOMImplementation("");
            final DOMImplementationLS domLS = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
            lsOutput = domLS.createLSOutput();
            lsOutput.setEncoding("UTF-8");
            lsSerializer = domLS.createLSSerializer();
        }
        lsOutput.setCharacterStream(writer);
        lsSerializer.write(node, lsOutput);
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : DOMImplementationLS(org.w3c.dom.ls.DOMImplementationLS) DOMImplementation(org.w3c.dom.DOMImplementation) XPathExpressionException(javax.xml.xpath.XPathExpressionException)

Aggregations

DOMImplementation (org.w3c.dom.DOMImplementation)82 Document (org.w3c.dom.Document)67 DOMException (org.w3c.dom.DOMException)35 Element (org.w3c.dom.Element)34 DocumentType (org.w3c.dom.DocumentType)28 DocumentBuilder (javax.xml.parsers.DocumentBuilder)25 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)22 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)22 ArrayList (java.util.ArrayList)8 TransformerException (javax.xml.transform.TransformerException)6 DOMImplementationRegistry (org.w3c.dom.bootstrap.DOMImplementationRegistry)6 DOMImplementationLS (org.w3c.dom.ls.DOMImplementationLS)6 IOException (java.io.IOException)5 Transformer (javax.xml.transform.Transformer)5 DOMSource (javax.xml.transform.dom.DOMSource)5 StreamResult (javax.xml.transform.stream.StreamResult)5 Node (org.w3c.dom.Node)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 NodeList (org.w3c.dom.NodeList)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3