public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { wrapperElement.serialize(output,format); }
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { wrapperElement.serialize(writer,format); }
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { wrapperElement.serialize(output,format); }
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { wrapperElement.serialize(xmlWriter); }
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { wrapperElement.serialize(writer,format); }
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { wrapperElement.serialize(xmlWriter); }
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()); } }
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)); } }
/** * 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(); }
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)); } }
private void toISOSummary( XMLStreamWriter writer ) throws XMLStreamException { writer = new FilteringXMLStreamWriter( writer, summaryFilterElementsXPath ); root.serialize( writer ); }
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); } }
private void toISOBrief( XMLStreamWriter writer ) throws XMLStreamException { writer = new FilteringXMLStreamWriter( writer, briefFilterElementsXPath ); root.serialize( writer ); }
/** * 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); }
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(); } }
@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 ); }
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); }
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(); }
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); } }
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)); }