本文整理汇总了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);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}