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

The following examples show how to use com.sun.xml.internal.ws.util.xml.XmlUtil#newTransformerFactory() . 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: StreamHeader.java    From TencentKona-8 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 2
Source File: StreamHeader.java    From jdk8u60 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 3
Source File: StreamHeader.java    From openjdk-jdk8u 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 4
Source File: StreamHeader.java    From openjdk-jdk8u-backup 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 5
Source File: StreamHeader.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.
        TransformerFactory tf = XmlUtil.newTransformerFactory(true);
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 6
Source File: StreamHeader.java    From hottub 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 7
Source File: StreamHeader.java    From openjdk-8-source 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 8
Source File: StreamHeader.java    From openjdk-8 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.
        TransformerFactory tf = XmlUtil.newTransformerFactory();
        Transformer t = tf.newTransformer();
        XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
        DOMResult result = new DOMResult();
        t.transform(source, result);
        Node d = result.getNode();
        if(d.getNodeType() == Node.DOCUMENT_NODE)
            d = d.getFirstChild();
        SOAPHeader header = saaj.getSOAPHeader();
        if(header == null)
            header = saaj.getSOAPPart().getEnvelope().addHeader();
        Node node = header.getOwnerDocument().importNode(d, true);
        header.appendChild(node);
    } catch (Exception e) {
        throw new SOAPException(e);
    }
}
 
Example 9
Source File: ExternalMetadataReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 10
Source File: ExternalMetadataReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 11
Source File: ExternalMetadataReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 12
Source File: ExternalMetadataReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 13
Source File: ExternalMetadataReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 14
Source File: ExternalMetadataReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 15
Source File: ExternalMetadataReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}
 
Example 16
Source File: ExternalMetadataReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    Transformer transformer = tf.newTemplates(xsl).newTransformer();
    transformer.transform(src, result);
    return getJavaWsdlMapping(result.getResult());
}