Package javax.xml.transform

Examples of javax.xml.transform.Transformer.transform()


    if (indent) {
      xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    }

    xformer.transform(source, result);

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

  public static void toString(Document doc, String encoding, Writer w, boolean indent) throws TransformerFactoryConfigurationError, TransformerException {
View Full Code Here


    if (indent) {
      xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    }

    xformer.transform(source, result);
  }

  public static Document parseXmlFile(String filename, boolean validating, boolean namespaceAware) throws SAXException, IOException, ParserConfigurationException {

    return parseXmlFile(new File(filename), validating, namespaceAware);
View Full Code Here

   
    if (indent) {
      xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    }

    xformer.transform(source, result);

  }

  public static void writeXmlFile(Document doc, File file, Entry<String,String>... outputKeys) throws TransformerFactoryConfigurationError, TransformerException {
    // Prepare the DOM document for writing
View Full Code Here

        xformer.setOutputProperty(entry.getKey(), entry.getValue());
      }
    }

    xformer.transform(source, result);

  }

  public static void writeXmlFile(Document doc, String filename, boolean indent, String encoding) throws TransformerFactoryConfigurationError, TransformerException {
View Full Code Here

          DOMSource source=new DOMSource();
          source.setNode(doc);
          StreamResult result=new StreamResult();
          FileOutputStream fileOutputStream =  new FileOutputStream(fileName);
          result.setOutputStream(fileOutputStream);
      transformer.transform(source, result);
      fileOutputStream.close();

    } catch (TransformerConfigurationException e) {
      e.printStackTrace();
    }catch (FileNotFoundException e) {
View Full Code Here

            throw Exceptions.transformFailed(ex);
        }
        result.setOutputStream(gzos);

        try {
            transformer.transform(source, result);
        } catch (TransformerException ex) {
            throw Exceptions.transformFailed(ex);
        }

        try {
View Full Code Here

        DOMResult    result       = new DOMResult();

        streamSource.setInputStream(stream);

        try {
            transformer.transform(streamSource, result);
        } catch (TransformerException ex) {
            throw Exceptions.transformFailed(ex);
        }
        source.setNode(result.getNode());
        source.setSystemId(result.getSystemId());
View Full Code Here

                //create string from xml tree
                StringWriter sw = new StringWriter();
                StreamResult result = new StreamResult(sw);
                DOMSource source = new DOMSource(jobDocument);
                trans.transform(source, result);
                String xmlString = sw.toString();

                try {
                    // Job ist evtl. in vorigem Job-Lauf angelegt worden
                    if (currJob.get("job_name") != null && this.spooler.job(currJob.get("job_name").toString()) != null) {
View Full Code Here

    public static void writeXmlTo(Node n, Writer w) {
        try {
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty("omit-xml-declaration", "false");   //TODO Funktioniert nur mit org.jdom?
            transformer.transform(new DOMSource(n), new StreamResult(w));
        } catch (TransformerException x) { throw new XmlException(x); }
    }


    public static boolean booleanXmlAttribute(Element xmlElement, String attributeName, boolean defaultValue) {
View Full Code Here

    final TransformerFactory tFactory = TransformerFactory.newInstance();
    final Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));

    if (outputFile == null) {
      transformer.transform(new StreamSource(this)// ...
          new StreamResult(new java.io.OutputStreamWriter(System.out)));
    }
    else {
//      final boolean append = true;
      transformer.transform(new StreamSource(this), // ...
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.