Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamResult


    SAXTransformerFactory transformerFactoryImpl =
      (SAXTransformerFactory)SAXTransformerFactory.newInstance();

    // Create serializer to write the SAX stream into a file
    TransformerHandler serializer = transformerFactoryImpl.newTransformerHandler();
    serializer.setResult(new StreamResult(outFile));

    // Connect components into a pipeline
    lexer.setContentHandler(parser);
    parser.setContentHandler(serializer);
View Full Code Here


          data = serializeWithStax(doc, staxOutputFactory, out);
        } else {
          data = serializeWithXOM(doc, out);
        }
      } else if (mode.equals("saxon")) {
        saxonSerializer.transform(saxonDoc, new StreamResult(out));
        data = out.toByteArray();
      } else if (mode.equals("dom")) {
        domSerializer.transform(new DOMSource(domDoc), new StreamResult(out));
        data = out.toByteArray();
      } else if (mode.startsWith("fi")) {
        if (mode.indexOf("stax") >= 0) {
//          data = serializeWithStax(doc, staxOutputFactory);
          data = serializeWithFastInfosetStax(doc, (XMLStreamWriter)fiSerializer, fiMethod, out);
View Full Code Here

  public final void print(Document document) throws Exception
  {
    TransformerFactory factory = TransformerFactory.newInstance();
    javax.xml.transform.Transformer serializer = factory.newTransformer();
    serializer.transform(new DOMSource(document), new StreamResult(System.out));
    System.out.println();
  }
View Full Code Here

                      data = serializeWithXOM(doc, out);
                    } else {
                      data = serializeWithStreamingXOM(doc, out);
                    }
                  } else if (mode.equals("saxon")) {
                    saxonSerializer.transform(saxonDoc, new StreamResult(out));
                    data = out.toByteArray();
                  } else if (mode.equals("dom")) {
                    domSerializer.transform(new DOMSource(domDoc), new StreamResult(out));
                    data = out.toByteArray();
                  } else if (mode.startsWith("fi")) {
                    if (mode.indexOf("stax") >= 0) {
//                      data = serializeWithStax(doc, staxOutputFactory);
                      data = serializeWithFastInfosetStax(doc, (XMLStreamWriter)fiSerializer, fiMethod, out);
View Full Code Here

  public final void print(Document document) throws Exception
  {
    TransformerFactory factory = TransformerFactory.newInstance();
    javax.xml.transform.Transformer serializer = factory.newTransformer();
    serializer.transform(new DOMSource(document), new StreamResult(System.out));
    System.out.println();
  }
View Full Code Here

        {
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer m = tf.newTransformer();
            DOMSource source = new DOMSource(doc);
            FileOutputStream os = new FileOutputStream(fileUrl.getFile());
            StreamResult result = new StreamResult(os);
            m.setOutputProperty(OutputKeys.INDENT, "yes");
            m.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, XMLAutoStarterEntityResolver.PUBLIC_ID_KEY);
            m.transform(source, result);
            os.close();
        }
View Full Code Here

    if (transFactory == null) {
      transFactory = TransformerFactory.newInstance();     
    }
      Transformer trans = transFactory.newTransformer();
      StringWriter sw = new StringWriter();
      trans.transform(new DOMSource(element), new StreamResult(sw));
      return new String(sw.toString());
  }
View Full Code Here

      Node n = requestHandler.invoke(reqElem);
     
      StringWriter sw = new StringWriter();
        Transformer t = TransformerFactory.newInstance().newTransformer();
      t.transform(new DOMSource(n), new StreamResult(sw));
      return sw.toString();
  }
View Full Code Here

  }

  public static String toString(Document doc, String encoding, boolean indent) throws TransformerFactoryConfigurationError, TransformerException {
    Source source = new DOMSource(doc);
    StringWriter sw = new StringWriter();
    Result result = new StreamResult(sw);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.ENCODING, encoding);

    if (indent) {
View Full Code Here

    return sw.getBuffer().toString();
  }

  public static void toString(Document doc, String encoding, Writer w, boolean indent) throws TransformerFactoryConfigurationError, TransformerException {
    Source source = new DOMSource(doc);
    Result result = new StreamResult(w);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.ENCODING, encoding);

    if (indent) {
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamResult

Copyright © 2018 www.massapicom. 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.