当前位置: 首页>>代码示例>>Java>>正文


Java XmlUtil.newDocumentBuilderFactory方法代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.util.xml.XmlUtil.newDocumentBuilderFactory方法的典型用法代码示例。如果您正苦于以下问题:Java XmlUtil.newDocumentBuilderFactory方法的具体用法?Java XmlUtil.newDocumentBuilderFactory怎么用?Java XmlUtil.newDocumentBuilderFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.xml.internal.ws.util.xml.XmlUtil的用法示例。


在下文中一共展示了XmlUtil.newDocumentBuilderFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeTo

import com.sun.xml.internal.ws.util.xml.XmlUtil; //导入方法依赖的package包/类
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);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:EPRHeader.java

示例2: createDom

import com.sun.xml.internal.ws.util.xml.XmlUtil; //导入方法依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:DOMUtil.java

示例3: createDom

import com.sun.xml.internal.ws.util.xml.XmlUtil; //导入方法依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:DOMUtil.java

示例4: createDom

import com.sun.xml.internal.ws.util.xml.XmlUtil; //导入方法依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:DOMUtil.java


注:本文中的com.sun.xml.internal.ws.util.xml.XmlUtil.newDocumentBuilderFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。