热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.axis2.util.XMLUtils.newDocument()方法的使用及代码示例

本文整理了Java中org.apache.axis2.util.XMLUtils.newDocument()方法的一些代码示例,展示了XMLUtils.newDocument()的具体用法。这些代码示

本文整理了Java中org.apache.axis2.util.XMLUtils.newDocument()方法的一些代码示例,展示了XMLUtils.newDocument()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLUtils.newDocument()方法的具体详情如下:
包路径:org.apache.axis2.util.XMLUtils
类名称:XMLUtils
方法名:newDocument

XMLUtils.newDocument介绍

[英]Gets an empty new Document.
[中]获取一个空的新文档。

代码示例

代码示例来源:origin: apache/axis2-java

/**
* Gets a new Document read from the indicated uri
*
* @return Returns Document.
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(String uri)
throws ParserConfigurationException, SAXException, IOException {
// call the authenticated version as there might be
// username/password info embeded in the uri.
return XMLUtils.newDocument(uri, null, null);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

/**
* Gets a new Document read from the indicated uri
*
* @return Returns Document.
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(String uri)
throws ParserConfigurationException, SAXException, IOException {
// call the authenticated version as there might be
// username/password info embeded in the uri.
return XMLUtils.newDocument(uri, null, null);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

/**
* Gets a new Document read from the input stream
*
* @return Returns Document.
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(InputStream inp)
throws ParserConfigurationException, SAXException, IOException {
return XMLUtils.newDocument(new InputSource(inp));
}

代码示例来源:origin: apache/axis2-java

/**
* Gets a new Document read from the input stream
*
* @return Returns Document.
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(InputStream inp)
throws ParserConfigurationException, SAXException, IOException {
return XMLUtils.newDocument(new InputSource(inp));
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

/**
* Creates a new document from the given URI. Uses the username and password
* if the URI requires authentication.
*
* @param uri the resource to get
* @param username basic auth username
* @param password basic auth password
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(String uri, String username, String password)
throws ParserConfigurationException, SAXException, IOException {
InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password);
Document doc = XMLUtils.newDocument(ins);
// Close the Stream
if (ins.getByteStream() != null) {
ins.getByteStream().close();
} else if (ins.getCharacterStream() != null) {
ins.getCharacterStream().close();
}
return doc;
}

代码示例来源:origin: apache/axis2-java

/**
* Creates a new document from the given URI. Uses the username and password
* if the URI requires authentication.
*
* @param uri the resource to get
* @param username basic auth username
* @param password basic auth password
* @throws ParserConfigurationException if construction problems occur
* @throws SAXException if the document has xml sax problems
* @throws IOException if i/o exceptions occur
*/
public static Document newDocument(String uri, String username, String password)
throws ParserConfigurationException, SAXException, IOException {
InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password);
Document doc = XMLUtils.newDocument(ins);
// Close the Stream
if (ins.getByteStream() != null) {
ins.getByteStream().close();
} else if (ins.getCharacterStream() != null) {
ins.getCharacterStream().close();
}
return doc;
}

代码示例来源:origin: org.apache.axis2/axis2-jaxbri

private static void registerNamespace(SchemaCompiler sc, String namespace, String pkgName) throws Exception {
Document doc = XMLUtils.newDocument();
Element rootElement = doc.createElement("schema");
rootElement.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");

代码示例来源:origin: apache/axis2-java

private static void registerNamespace(SchemaCompiler sc, String namespace, String pkgName) throws Exception {
Document doc = XMLUtils.newDocument();
Element rootElement = doc.createElement("schema");
rootElement.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");
rootElement.setAttribute("xmlns:jaxb", "http://java.sun.com/xml/ns/jaxb");
rootElement.setAttribute("jaxb:version", "2.0");
rootElement.setAttribute("targetNamespace", namespace);
Element annoElement = doc.createElement("annotation");
Element appInfo = doc.createElement("appinfo");
Element schemaBindings = doc.createElement("jaxb:schemaBindings");
Element pkgElement = doc.createElement("jaxb:package");
pkgElement.setAttribute("name", pkgName);
annoElement.appendChild(appInfo);
appInfo.appendChild(schemaBindings);
schemaBindings.appendChild(pkgElement);
rootElement.appendChild(annoElement);
MemoryBlob blob = Blobs.createMemoryBlob();
OutputStream stream = blob.getOutputStream();
Result result = new StreamResult(stream);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(new DOMSource(rootElement), result);
stream.close();
InputSource ins = new InputSource(blob.getInputStream());
ins.setSystemId("urn:" + UUID.randomUUID());
sc.parseSchema(ins);
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

public HandlerChainsType loadHandlerChains(InputStream in) throws Exception {
Document document = XMLUtils.newDocument(in);
Element el = document.getDocumentElement();
if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
!"handler-chains".equals(el.getLocalName())) {
throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAINS + " element");
}
HandlerChainsType handlerChains = new HandlerChainsType();
Node node = el.getFirstChild();
while (node != null) {
if (node instanceof Element) {
el = (Element)node;
if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
!el.getLocalName().equals("handler-chain")) {
throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAIN + " element");
}
handlerChains.getHandlerChain().add(processHandlerChainElement(el));
}
node = node.getNextSibling();
}
return handlerChains;
}

代码示例来源:origin: apache/axis2-java

public HandlerChainsType loadHandlerChains(InputStream in) throws Exception {
Document document = XMLUtils.newDocument(in);
Element el = document.getDocumentElement();
if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
!"handler-chains".equals(el.getLocalName())) {
throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAINS + " element");
}
HandlerChainsType handlerChains = new HandlerChainsType();
Node node = el.getFirstChild();
while (node != null) {
if (node instanceof Element) {
el = (Element)node;
if (!JAVA_EE_NS.equals(el.getNamespaceURI()) ||
!el.getLocalName().equals("handler-chain")) {
throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAIN + " element");
}
handlerChains.getHandlerChain().add(processHandlerChainElement(el));
}
node = node.getNextSibling();
}
return handlerChains;
}

代码示例来源:origin: apache/axis2-java

try {
InputStream in = wsdlURL.openConnection().getInputStream();
Document doc = XMLUtils.newDocument(in);
String namespaceURI = doc.getDocumentElement().getNamespaceURI();
if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {

代码示例来源:origin: org.apache.axis2/axis2-kernel

try {
InputStream in = wsdlURL.openConnection().getInputStream();
Document doc = XMLUtils.newDocument(in);
String namespaceURI = doc.getDocumentElement().getNamespaceURI();
if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {

代码示例来源:origin: org.apache.synapse/synapse-core

Document doc = null;
try {
doc = XMLUtils.newDocument(inputSource);
} catch (ParserConfigurationException e) {
handleException("Parser Configuration Error", e);

代码示例来源:origin: wso2/wso2-synapse

Document doc = null;
try {
doc = XMLUtils.newDocument(inputSource);
} catch (ParserConfigurationException e) {
handleException("Parser Configuration Error", e);

代码示例来源:origin: org.apache.axis2/axis2-kernel

Document doc;
try {
doc = XMLUtils.newDocument(in);
} catch (ParserConfigurationException e) {
throw new WSDLException(WSDLException.PARSER_ERROR,

代码示例来源:origin: apache/axis2-java

Document doc;
try {
doc = XMLUtils.newDocument(in);
} catch (ParserConfigurationException e) {
throw new WSDLException(WSDLException.PARSER_ERROR,

推荐阅读
author-avatar
手机用户2502854043
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有