Java XML Document Create toDocument(SOAPMessage soapMsg)

Here you can find the source of toDocument(SOAPMessage soapMsg)

Description

to Document

License

Open Source License

Declaration

public static Document toDocument(SOAPMessage soapMsg)
            throws TransformerConfigurationException, TransformerException, SOAPException, IOException 

Method Source Code

//package com.java2s;

import java.io.IOException;

import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;

import org.w3c.dom.Document;

public class Main {
    public static Document toDocument(SOAPMessage soapMsg)
            throws TransformerConfigurationException, TransformerException, SOAPException, IOException {
        Source src = soapMsg.getSOAPPart().getContent();
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer transformer = tf.newTransformer();
        DOMResult result = new DOMResult();
        transformer.transform(src, result);
        return (Document) result.getNode();
    }//www  .j a v a 2  s.c  om
}

Related

  1. stringToDocument(String xmlStr, boolean isValidating)
  2. stringToDocument(String xmlString)
  3. toDocument(File f)
  4. toDocument(Reader reader)
  5. toDocument(ResultSet rs)
  6. toDomDocument(Node domNode)