Package javax.xml.stream

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


            // Write XML content type
            response.setHeader("Content-Type", "text/xml");

            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            XMLStreamWriter xml = outputFactory.createXMLStreamWriter(response.getWriter());

            // Begin document
            xml.writeStartDocument();
            xml.writeStartElement("permissions");
            xml.writeAttribute("user", user.getUsername());
View Full Code Here


     
      is = new FileInputStream(inputFile);
      reader = xif.createXMLStreamReader(is);
     
      os = new FileOutputStream(trainingOutputFile);
      writer = xof.createXMLStreamWriter(os);
      int trainingDataCount = extractXMLData(reader, writer, trainingDataSize);
      os.close();
     
      os = new FileOutputStream(testOutputFile);
      writer = xof.createXMLStreamWriter(os);
View Full Code Here

      writer = xof.createXMLStreamWriter(os);
      int trainingDataCount = extractXMLData(reader, writer, trainingDataSize);
      os.close();
     
      os = new FileOutputStream(testOutputFile);
      writer = xof.createXMLStreamWriter(os);
      int testDataCount = extractXMLData(reader, writer, testDataSize);
      os.close();
     
      log.info("Extracted " + trainingDataCount + " rows of training data");
      log.info("Extracted " + testDataCount     + " rows of test data");
View Full Code Here

    private void writeInfoPlist(File file) throws IOException {
        Writer out = new BufferedWriter(new FileWriter(file));
        XMLOutputFactory output = XMLOutputFactory.newInstance();

        try {
            XMLStreamWriter xout = output.createXMLStreamWriter(out);

            // Write XML declaration
            xout.writeStartDocument();
            xout.writeCharacters("\n");
View Full Code Here

            StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
           
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            try {
                XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
                XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
                processor.write(composite, writer);
                writer.flush();
                writer.close();
            } catch (Exception ex) {
                System.out.println(ex.toString());
View Full Code Here

   
    @Converter
    public XMLStreamWriter createXMLStreamWriter(OutputStream outputStream, Exchange exchange) throws XMLStreamException {
        XMLOutputFactory factory = getOutputFactory();
        try {
            return factory.createXMLStreamWriter(IOHelper.buffered(outputStream), IOHelper.getCharsetName(exchange));
        } finally {
            returnXMLOutputFactory(factory);
        }
    }
View Full Code Here

    @Converter
    public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
        XMLOutputFactory factory = getOutputFactory();
        try {
            return factory.createXMLStreamWriter(IOHelper.buffered(writer));
        } finally {
            returnXMLOutputFactory(factory);
        }
    }
View Full Code Here

                //FIXME - if not woodstox, this will likely not work well
                //likely should copy CXF's W3CDOM stuff
                LOG.info("DOMResult is known to have issues with {0}. We suggest using Woodstox",
                         factory.getClass());
            }
            return factory.createXMLStreamWriter(result);
        } finally {
            returnXMLOutputFactory(factory);
        }
    }
   
View Full Code Here

        XMLOutputFactory outputFactory =
            nodeFactory.getExtensionPointRegistry().getExtensionPoint(FactoryExtensionPoint.class)
                .getFactory(XMLOutputFactory.class);
       
        try {
            compositeProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), new ProcessorContext(nodeFactory.registry));
        } catch(Exception ex) {
            return ex.toString();
        }
       
        String result = bos.toString();
View Full Code Here

            writer = mc.getContent(XMLStreamWriter.class);
            if (writer == null) {
                XMLOutputFactory factory = (XMLOutputFactory)mc.get(XMLOutputFactory.class.getName());
                if (factory != null) {
                    try {
                        writer = factory.createXMLStreamWriter(os);
                    } catch (XMLStreamException e) {
                        throw new WebApplicationException(
                            new RuntimeException("Cant' create XMLStreamWriter", e));
                    }
                }
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.