Examples of createXMLStreamWriter()


Examples of com.ctc.wstx.stax.WstxOutputFactory.createXMLStreamWriter()

    public static <T> void document(Codec<T> codec, DocumentType type,
                                    OutputStream out) {
        WstxOutputFactory documentFactory = new WstxOutputFactory();
        XmlWriter writer;
        try {
            writer = new StreamingXmlWriter(documentFactory
                    .createXMLStreamWriter(out));
            DefaultDocumentBuilder builder = type.createDocumentBuilder(writer);
            ArticleDocument document = new DefaultArticleDocument(builder,
                    codec.getCodecDescriptor().getTitle());
            document(codec, document);
View Full Code Here

Examples of de.odysseus.staxon.json.JsonXMLOutputFactory.createXMLStreamWriter()

            XMLOutputFactory outputFactory = new JsonXMLOutputFactory();
            outputFactory.setProperty(JsonXMLOutputFactory.PROP_AUTO_ARRAY, true);
            outputFactory.setProperty(JsonXMLOutputFactory.PROP_PRETTY_PRINT, true);
            StringWriter writer = new StringWriter();
            XMLStreamWriter output = outputFactory.createXMLStreamWriter(writer);
            Result result = new StAXResult(output);

            doTransform(message, enc, source, result);
            return writer.toString();
        }
View Full Code Here

Examples of javanet.staxutils.StaxUtilsXMLOutputFactory.createXMLStreamWriter()

  private static void write(File outputXml, Review review) throws IOException, XMLStreamException {
    StaxUtilsXMLOutputFactory xmlof = new StaxUtilsXMLOutputFactory(XMLOutputFactory.newInstance());
    xmlof.setProperty(StaxUtilsXMLOutputFactory.INDENTING, true);
    XMLStreamWriter writer = null;
    try {
      writer = xmlof.createXMLStreamWriter(new FileOutputStream(outputXml), "UTF-8");
      writer.writeStartDocument("UTF-8", "1.0");

      StaxReviewXmlUtil.writeReview(writer, review);
    }
    finally {
View Full Code Here

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

     * @throws IOException if there are problems writing to the file.
     */
    public void write(MappingDocument doc, PrintWriter stream) throws IOException {
        try {
          XMLOutputFactory xof = XMLOutputFactory.newInstance();
          writer = xof.createXMLStreamWriter(stream);
          writer.writeStartDocument("UTF-8", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
          writer.writeStartElement(ELEM_ROOT);
          writeElement(MappingNodeConstants.Tags.DOCUMENT_ENCODING, doc.getDocumentEncoding());
          writeElement(MappingNodeConstants.Tags.FORMATTED_DOCUMENT, Boolean.toString(doc.isFormatted()));
          loadNode(doc.getRootNode());
View Full Code Here

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

      public void translate(Writer writer) throws TransformerException,
          IOException {
          try {
            JSONParser parser = new JSONParser();
          XMLOutputFactory factory = getOutputFactory();
          final XMLStreamWriter streamWriter = factory.createXMLStreamWriter(writer);
           
          parser.parse(r, new JsonToXmlContentHandler(escapeName(rootName, true), streamWriter));
           
          streamWriter.flush(); //woodstox needs a flush rather than a close
        } catch (XMLStreamException e) {
View Full Code Here

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

        // marshal root object back out to document in memory
        IMarshallingContext mctx = bfact.createMarshallingContext();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, enc);
            mctx.setXmlWriter(new StAXWriter(bfact.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
View Full Code Here

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

        // marshal root object back out to document in memory
        IMarshallingContext mctx = bfact.createMarshallingContext();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, enc);
            mctx.setXmlWriter(new StAXWriter(bfact.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
View Full Code Here

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

        // marshal bean back out to document in memory
        IMarshallingContext mctx = obf.createMarshallingContext();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, "UTF-8");
            mctx.setXmlWriter(new StAXWriter(obf.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
View Full Code Here

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

        XQueryModule module = proc.parse(input);

        // prepare a result handler (StAX)
        Writer writer = new StringWriter();
        XMLOutputFactory factory = XMLOutputFactory.newInstance();
        XMLStreamWriter streamWriter = factory.createXMLStreamWriter(writer);
        XQEventReceiver handler = new StAXSerializer(streamWriter);

        // #2 execute the compiled expression using ``push'' mode
        //   In push mode, the result is directed to the events.
        proc.execute(module, handler);
View Full Code Here

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

    FileOutputStream fos = new FileOutputStream(fileout);
    GZIPOutputStream zos = new GZIPOutputStream(fos);

    //staxWriter = fac.createXMLStreamWriter(System.out, "UTF-8");
    //staxWriter = fac.createXMLStreamWriter(fos, "UTF-8");
    staxWriter = fac.createXMLStreamWriter(zos, "UTF-8");

    staxWriter.writeStartDocument("UTF-8", "1.0");
    staxWriter.writeCharacters("\n");
    staxWriter.writeStartElement("bufrMessages");
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.