Java Code Examples for com.sun.xml.internal.ws.util.xml.XmlUtil#newDocumentBuilderFactory()

The following examples show how to use com.sun.xml.internal.ws.util.xml.XmlUtil#newDocumentBuilderFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EPRHeader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void writeTo(SOAPMessage saaj) throws SOAPException {
        try {
            // TODO what about in-scope namespaces
            // Not very efficient consider implementing a stream buffer
            // processor that produces a DOM node from the buffer.
            Transformer t = XmlUtil.newTransformer();
            SOAPHeader header = saaj.getSOAPHeader();
            if (header == null)
                header = saaj.getSOAPPart().getEnvelope().addHeader();
// TODO workaround for oracle xdk bug 16555545, when this bug is fixed the line below can be
// uncommented and all lines below, except the catch block, can be removed.
//            t.transform(epr.asSource(localName), new DOMResult(header));
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XMLStreamWriter w = XMLOutputFactory.newFactory().createXMLStreamWriter(baos);
            epr.writeTo(localName, w);
            w.flush();
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            DocumentBuilderFactory fac = XmlUtil.newDocumentBuilderFactory(false);
            fac.setNamespaceAware(true);
            Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement();
            Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true);
            header.appendChild(eprNodeToAdd);
        } catch (Exception e) {
            throw new SOAPException(e);
        }
    }
 
Example 2
Source File: DOMUtil.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 3
Source File: DOMUtil.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 4
Source File: DOMUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 5
Source File: DOMUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 6
Source File: DOMUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(true);
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 7
Source File: DOMUtil.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 8
Source File: DOMUtil.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example 9
Source File: DOMUtil.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}