本文整理了Java中org.apache.axiom.om.OMElement.serialize()
方法的一些代码示例,展示了OMElement.serialize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.serialize()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:serialize
[英]Serialize the node with caching enabled.
This method will always serialize the infoset as plain XML. In particular, any OMTextcontaining optimized binary will be inlined using base64 encoding.
[中]在启用缓存的情况下序列化节点。
此方法始终将信息集序列化为纯XML。特别是,任何包含优化二进制文件的OMTEXT都将使用base64编码进行内联。
代码示例来源:origin: org.apache.axis2/axis2-kernel
public void serialize(OutputStream output, OMOutputFormat format)
throws XMLStreamException {
wrapperElement.serialize(output,format);
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
public void serialize(Writer writer, OMOutputFormat format)
throws XMLStreamException {
wrapperElement.serialize(writer,format);
}
代码示例来源:origin: apache/axis2-java
public void serialize(OutputStream output, OMOutputFormat format)
throws XMLStreamException {
wrapperElement.serialize(output,format);
}
代码示例来源:origin: apache/axis2-java
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
wrapperElement.serialize(xmlWriter);
}
代码示例来源:origin: apache/axis2-java
public void serialize(Writer writer, OMOutputFormat format)
throws XMLStreamException {
wrapperElement.serialize(writer,format);
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
wrapperElement.serialize(xmlWriter);
}
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.reporting.template.core
private void saveTempfile() {
try {
File file = new File("metadata.xml");
FileWriter fstream = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fstream);
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(out);
reportsElement.serialize(writer, true);
writer.flush();
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
public static void prettify(OMElement wsdlElement, OutputStream out) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
wsdlElement.serialize(baos);
Source stylesheetSource = new StreamSource(new ByteArrayInputStream(prettyPrintStylesheet.getBytes()));
Source xmlSource = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
TransformerFactory tf = TransformerFactory.newInstance();
Templates templates = tf.newTemplates(stylesheetSource);
Transformer transformer = templates.newTransformer();
transformer.transform(xmlSource, new StreamResult(out));
}
}
代码示例来源:origin: org.apache.axis2/axis2-saaj
/**
* Convert a given OMElement to a DOM Element
*
* @param element
* @return DOM Element
*/
public static org.w3c.dom.Element toDOM(OMElement element) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
element.serialize(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
return factory.newDocumentBuilder().parse(bais).getDocumentElement();
}
代码示例来源:origin: apache/axis2-java
public static void prettify(OMElement wsdlElement, OutputStream out) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
wsdlElement.serialize(baos);
Source stylesheetSource = new StreamSource(new ByteArrayInputStream(prettyPrintStylesheet.getBytes()));
Source xmlSource = new StreamSource(new ByteArrayInputStream(baos.toByteArray()));
TransformerFactory tf = TransformerFactory.newInstance();
Templates templates = tf.newTemplates(stylesheetSource);
Transformer transformer = templates.newTransformer();
transformer.transform(xmlSource, new StreamResult(out));
}
}
代码示例来源:origin: deegree/deegree3
private void toISOSummary( XMLStreamWriter writer )
throws XMLStreamException {
writer = new FilteringXMLStreamWriter( writer, summaryFilterElementsXPath );
root.serialize( writer );
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
public String transform(OMElement source, TransformationContext context) {
try {
StringWriter writer = new StringWriter();
source.serialize(writer);
return writer.toString();
} catch (XMLStreamException e) {
throw new TransformationException(e);
}
}
代码示例来源:origin: deegree/deegree3
private void toISOBrief( XMLStreamWriter writer )
throws XMLStreamException {
writer = new FilteringXMLStreamWriter( writer, briefFilterElementsXPath );
root.serialize( writer );
}
代码示例来源:origin: org.apache.synapse/synapse-core
/**
* Order of entries is irrelevant, however its nice to have some order.
* @param synCfg
* @param outputStream
* @throws XMLStreamException
*/
public static void serializeConfiguration(SynapseConfiguration synCfg,
OutputStream outputStream) throws XMLStreamException {
if (log.isDebugEnabled()) {
log.debug("Serializing the XML Configuration to the output stream");
}
OMElement definitions
= ConfigurationFactoryAndSerializerFinder.serializeConfiguration(synCfg);
definitions.serialize(outputStream);
}
代码示例来源:origin: deegree/deegree3
private byte[] getAsByteArray( OMElement root ) {
root.declareDefaultNamespace( "http://www.isotc211.org/2005/gmd" );
try {
ByteArrayOutputStream out = new ByteArrayOutputStream( 20000 );
root.serialize( out );
out.close();
return out.toByteArray();
} catch ( XMLStreamException e ) {
return root.toString().getBytes();
} catch ( IOException e ) {
return root.toString().getBytes();
}
}
代码示例来源:origin: deegree/deegree3
@Override
public void serialize( XMLStreamWriter writer, String[] elementNames )
throws XMLStreamException {
List<XPath> xpathEN = new ArrayList<XPath>();
for ( String s : elementNames ) {
xpathEN.add( new XPath( s, CommonNamespaces.getNamespaceContext() ) );
}
if ( !xpathEN.isEmpty() ) {
writer = new FilteringXMLStreamWriter( writer, xpathEN );
}
root.serialize( writer );
}
代码示例来源:origin: apache/axis2-java
public static void main(String[] ars) throws AxisFault, XMLStreamException {
// Client side keystore location, here we use same keystore
System.setProperty("javax.net.ssl.trustStore", "../httpsService/target/jetty-ssl.keystore");
System.setProperty("javax.net.ssl.trustStorePassword", "axis2key");
String epr = "https://localhost:8443/services/SimpleService/";
Options options = new Options();
options.setTo(new EndpointReference(epr));
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement ret = sender.sendReceive(creatMsg());
ret.serialize(System.out);
}
代码示例来源:origin: wso2/wso2-synapse
public void setUp() throws Exception {
writeToFile(TEXT_1);
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement root = factory.createOMElement("root", null);
for (int i=0; i<1000; i++) {
OMElement child = factory.createOMElement("child", null);
child.setText("some text");
root.addChild(child);
}
FileOutputStream out = new FileOutputStream(FILE2);
root.serialize(out);
out.close();
}
代码示例来源:origin: wso2/wso2-synapse
public void testSerializeToChars() throws Exception {
OMSourcedElement element = createSourcedElement("test", UTF8);
StringWriter sw = new StringWriter();
element.serialize(sw);
String actual = sw.toString();
sw.getBuffer().setLength(0);
// Compare with the behavior of an equivalent OMElement
element.cloneOMElement().serialize(sw);
String expected = sw.toString();
assertEquals(expected, actual);
}
}
代码示例来源:origin: wso2/wso2-synapse
public void testSerializeToBytes() throws Exception {
OMSourcedElement element = createSourcedElement("test", UTF8);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
element.serialize(baos);
byte[] actual = baos.toByteArray();
baos.reset();
// We validate the result by creating an equivalent OMElement
// and calling serialize on it. The two results must be identical.
element.cloneOMElement().serialize(baos);
byte[] expected = baos.toByteArray();
assertTrue(Arrays.equals(expected, actual));
}
内容来源于网络,如有侵权,请联系作者删除!