Package javax.xml.stream

Examples of javax.xml.stream.XMLOutputFactory.createXMLStreamWriter()


        if (encoding == null) {
            encoding = "UTF-8";
        }
        XMLOutputFactory factory = getXMLOutputFactory();
        try {
            return factory.createXMLStreamWriter(out, encoding);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Cant' create XMLStreamWriter", e);
        } finally {
            returnXMLOutputFactory(factory);
        }
View Full Code Here


    }
   
    public static XMLStreamWriter createXMLStreamWriter(Result r) {
        XMLOutputFactory factory = getXMLOutputFactory();
        try {
            return factory.createXMLStreamWriter(r);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Cant' create XMLStreamWriter", e);
        } finally {
            returnXMLOutputFactory(factory);
        }
View Full Code Here

    private JSONUtils() {
    }
   
    public static XMLStreamWriter createBadgerFishWriter(OutputStream os) throws XMLStreamException {
        XMLOutputFactory factory = new BadgerFishXMLOutputFactory();
        return factory.createXMLStreamWriter(os);
    }
   
    public static XMLStreamReader createBadgerFishReader(InputStream is) throws XMLStreamException {
        XMLInputFactory factory = new BadgerFishXMLInputFactory();
        return factory.createXMLStreamReader(is);
View Full Code Here

        XMLStreamReader streamReader = inputFactory.createXMLStreamReader(payload.getInputStream());
        Source staxSource = StaxUtils.createCustomStaxSource(streamReader);
        transformer.transform(staxSource, webServiceMessage.getPayloadResult());
        StringWriter stringWriter = new StringWriter();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(stringWriter);
        Result staxResult = StaxUtils.createCustomStaxResult(streamWriter);
        transformer.transform(webServiceMessage.getPayloadSource(), staxResult);
        streamWriter.flush();
        assertXMLEqual(getExpectedString(), stringWriter.toString());
        validateMessage();
View Full Code Here

    }

    @Test
    public void testDoWithStaxResultStreamWriter() throws Exception {
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(new StringWriter());

        TraxUtils.ResultCallback mock = createMock(TraxUtils.ResultCallback.class);
        mock.staxResult(streamWriter);

        replay(mock);
View Full Code Here

   

    public static XMLStreamWriter createXMLStreamWriter(Writer out) {
        XMLOutputFactory factory = getXMLOutputFactory();
        try {
            return factory.createXMLStreamWriter(out);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Cant' create XMLStreamWriter", e);
        } finally {
            returnXMLOutputFactory(factory);
        }
View Full Code Here

        if (encoding == null) {
            encoding = "UTF-8";
        }
        XMLOutputFactory factory = getXMLOutputFactory();
        try {
            return factory.createXMLStreamWriter(out, encoding);
        } catch (XMLStreamException e) {
            throw new RuntimeException("Cant' create XMLStreamWriter", e);
        } finally {
            returnXMLOutputFactory(factory);
        }
View Full Code Here

    *          if can't open output stream from file
    */
   protected void saveBindings() throws FileNotFoundException, XMLStreamException
   {
      XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
      XMLStreamWriter writer = outputFactory.createXMLStreamWriter(new FileOutputStream(bindingsStorePath), "UTF-8");

      writer.writeStartDocument("UTF-8", "1.0");
      writer.writeStartElement(BIND_REFERENCES_ELEMENT);

      for (Entry<String, Reference> entry : bindings.entrySet())
View Full Code Here

         public void run()
         {
            try
            {
               XMLOutputFactory factory = XMLOutputFactory.newInstance();
               XMLStreamWriter writer = factory.createXMLStreamWriter(po, Constants.DEFAULT_ENCODING);

               writer.writeStartDocument(Constants.DEFAULT_ENCODING, "1.0");
               writer.writeStartElement(XML_NODE);
               writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
               writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
View Full Code Here

      pgTXs = new HashSet<>();

      queueBindings = new HashMap<>();

      XMLOutputFactory factory = XMLOutputFactory.newInstance();
      XMLStreamWriter rawXmlWriter = factory.createXMLStreamWriter(out, "UTF-8");
      PrettyPrintHandler handler = new PrettyPrintHandler(rawXmlWriter);
      xmlWriter = (XMLStreamWriter) Proxy.newProxyInstance(
         XMLStreamWriter.class.getClassLoader(),
         new Class[]{XMLStreamWriter.class},
         handler);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.