本文整理了Java中org.apache.axiom.om.OMXMLBuilderFactory
类的一些代码示例,展示了OMXMLBuilderFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMXMLBuilderFactory
类的具体详情如下:
包路径:org.apache.axiom.om.OMXMLBuilderFactory
类名称:OMXMLBuilderFactory
[英]Provides static factory methods to create various kinds of object model builders from different types of input sources. The methods defined by this class are the starting point to parse XML documents into Axiom trees.
[中]提供静态工厂方法,从不同类型的输入源创建各种对象模型生成器。此类定义的方法是将XML文档解析为Axiom树的起点。
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Create an object model builder that reads a plain XML document from the provided input stream
* with a given parser configuration.
*
* @param configuration
* the parser configuration to use
* @param in
* the input stream representing the XML document
* @return the builder
*/
public static OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration, InputStream in) {
return createOMBuilder(configuration, in, null);
}
代码示例来源:origin: org.apache.axis2/axis2-transport-testkit
public XMLMessage decode(ContentType contentType, String message) throws Exception {
XMLMessage.Type type = XMLMessage.getTypeFromContentType(contentType);
if (type == null) {
throw new Exception("Unrecognized content type " + contentType);
}
OMElement payload;
if (type == XMLMessage.Type.POX) {
payload = OMXMLBuilderFactory.createOMBuilder(new StringReader(message)).getDocumentElement();
} else {
payload = OMXMLBuilderFactory.createSOAPModelBuilder(new StringReader(message)).getSOAPEnvelope().getBody().getFirstElement();
}
return new XMLMessage(payload, type);
}
};
代码示例来源:origin: org.apache.neethi/neethi
public OMElement convert(XMLStreamReader s) {
return OMXMLBuilderFactory
.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), s)
.getDocumentElement();
}
代码示例来源:origin: org.springframework.ws/spring-ws-core
/**
* Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}.
*
* @param document the document to be converted
* @return the converted envelope
* @throws IllegalArgumentException in case of errors
*/
public static SOAPEnvelope toEnvelope(Document document) {
return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope();
}
代码示例来源:origin: org.apache.rampart/rampart-core
SOAPModelBuilder stAXSOAPModelBuilder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
reader);
SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();
ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray());
SOAPModelBuilder stAXSOAPModelBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(bais, null);
return stAXSOAPModelBuilder.getSOAPEnvelope();
} catch (Exception e) {
代码示例来源:origin: org.apache.synapse/synapse-core
public OMElement getNode(Charset charset) {
try {
out.close();
} catch (IOException e) {
handleException("Error while closing output stream", e);
}
if (expectedOutput == ResultBuilderFactory.Output.TEXT) {
return TextFileDataSource.createOMSourcedElement(tmp, charset);
} else {
XMLStreamReader reader;
try {
reader = StAXUtils.createXMLStreamReader(tmp.getInputStream());
} catch (XMLStreamException e) {
handleException("Unable to parse the XML output", e);
return null;
} catch (IOException e) {
handleException("I/O error while reading temporary file", e);
return null;
}
if (expectedOutput == ResultBuilderFactory.Output.SOAP_ENVELOPE) {
return OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader).getSOAPEnvelope();
} else {
return OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement();
}
}
}
代码示例来源:origin: apache/axis2-java
public static org.apache.axiom.soap.SOAPEnvelope
getSOAPEnvelopeFromDOOMDocument(org.w3c.dom.Document doc) {
return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)doc.getDocumentElement()).getXMLStreamReader()).getSOAPEnvelope();
}
代码示例来源:origin: spring-projects/spring-ws
/**
* Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}.
*
* @param document the document to be converted
* @return the converted envelope
* @throws IllegalArgumentException in case of errors
*/
public static SOAPEnvelope toEnvelope(Document document) {
return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope();
}
代码示例来源:origin: org.apache.synapse/synapse-core
private SOAPEnvelope getSOAPEnvFromOM(OMElement inlineElement) {
return OMXMLBuilderFactory.createStAXSOAPModelBuilder(
inlineElement.getXMLStreamReader()).getSOAPEnvelope();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Create an object model builder that reads a plain XML document from the provided input stream
* with the default parser configuration defined by {@link StAXParserConfiguration#DEFAULT}.
*
* @param in
* the input stream representing the XML document
* @return the builder
*/
public static OMXMLParserWrapper createOMBuilder(InputStream in) {
return createOMBuilder(StAXParserConfiguration.DEFAULT, in);
}
代码示例来源:origin: apache/axis2-java
public XMLMessage decode(ContentType contentType, String message) throws Exception {
XMLMessage.Type type = XMLMessage.getTypeFromContentType(contentType);
if (type == null) {
throw new Exception("Unrecognized content type " + contentType);
}
OMElement payload;
if (type == XMLMessage.Type.POX) {
payload = OMXMLBuilderFactory.createOMBuilder(new StringReader(message)).getDocumentElement();
} else {
payload = OMXMLBuilderFactory.createSOAPModelBuilder(new StringReader(message)).getSOAPEnvelope().getBody().getFirstElement();
}
return new XMLMessage(payload, type);
}
};
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Create an object model builder for SOAP that reads a message from the provided {@link Source}.
* The method will select the appropriate {@link SOAPFactory} based on the namespace URI of
* the SOAP envelope.
*
* @param source
* the source of the SOAP message
* @return the builder
*/
public static SOAPModelBuilder createSOAPModelBuilder(Source source) {
return createSOAPModelBuilder(OMAbstractFactory.getMetaFactory(), source);
}
代码示例来源:origin: apache/axis2-java
public static OMElement getOMElement(SOAPEnvelope response) {
return OMXMLBuilderFactory.createStAXOMBuilder(response.getXMLStreamReader()).getDocumentElement();
}
代码示例来源:origin: apache/axis2-java
public static org.apache.axiom.soap.SOAPEnvelope
toOMSOAPEnvelope(org.w3c.dom.Element elem) {
return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)elem).getXMLStreamReader()).getSOAPEnvelope();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Create an object model builder that reads a plain XML document from the provided character
* stream with the default parser configuration defined by
* {@link StAXParserConfiguration#DEFAULT}.
*
* @param in
* the character stream representing the XML document
* @return the builder
*/
public static OMXMLParserWrapper createOMBuilder(Reader in) {
return createOMBuilder(StAXParserConfiguration.DEFAULT, in);
}
代码示例来源:origin: apache/axis2-java
if (attachments.getAttachmentSpecType().equals(
MTOMConstants.MTOM_TYPE)) {
return OMXMLBuilderFactory.createSOAPModelBuilder(attachments);
} else {
return OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getRootPartInputStream(), charSetEncoding);
return OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments);
} else {
return OMXMLBuilderFactory.createOMBuilder(attachments.getRootPartInputStream(), charSetEncoding);
代码示例来源:origin: apache/servicemix-bundles
/**
* Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}.
*
* @param document the document to be converted
* @return the converted envelope
* @throws IllegalArgumentException in case of errors
*/
public static SOAPEnvelope toEnvelope(Document document) {
return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope();
}
代码示例来源:origin: org.apache.rampart/rampart-trust
private OMElement convertStringToOMElement(String stringElement)
throws IOException {
if (null == stringElement || stringElement.trim().equals("")) {
return null;
}
try {
Reader in = new StringReader(stringElement);
XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(in);
OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(parser);
OMElement documentElement = builder.getDocumentElement();
XMLStreamReader llomReader = documentElement.getXMLStreamReader();
OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
OMFactory doomFactory = metaFactory.getOMFactory();
OMXMLParserWrapper doomBuilder = OMXMLBuilderFactory.createStAXOMBuilder(doomFactory, llomReader);
return doomBuilder.getDocumentElement();
} catch (XMLStreamException e) {
log.error("Cannot convert de-serialized string to OMElement. Could not create XML stream.", e);
// IOException only has a constructor supporting exception chaining starting with Java 1.6
IOException ex = new IOException("Cannot convert de-serialized string to OMElement. Could not create XML stream.");
ex.initCause(e);
throw ex;
}
}
}
代码示例来源:origin: apache/axis2-java
protected void assertSOAPEchoResponse(String textValue, XMLStreamReader reader) {
SOAPEnvelope env = OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader).getSOAPEnvelope();
assertEchoResponse(textValue, env.getBody().getFirstElement());
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Create an object model builder that reads an XML document from the provided input stream
* using a specified object model factory and with the default parser configuration defined by
* {@link StAXParserConfiguration#DEFAULT}.
*
* @param omFactory
* the object model factory to use
* @param in
* the input stream representing the XML document
* @return the builder
*/
public static OMXMLParserWrapper createOMBuilder(OMFactory omFactory, InputStream in) {
return createOMBuilder(omFactory, StAXParserConfiguration.DEFAULT, in);
}
内容来源于网络,如有侵权,请联系作者删除!