Package javax.xml.transform.dom

Examples of javax.xml.transform.dom.DOMSource


      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.newDocument();
      Node df = doc.createDocumentFragment();

      return getDTM(new DOMSource(df), true, null, false, false);
    }
    catch (Exception e)
    {
      throw new DTMException(e);
    }
View Full Code Here


        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

        // transform OUTPUT
        try {
            transformer.transform(new DOMSource(document), streamResult);
        } catch (TransformerException e) {
            throw new IllegalStateException("Unable to transform the document", e);
        }

        return stringWriter.toString();
View Full Code Here

    // The XML document we created above is still in memory
    // so we have to output it to a real file.
    // In order to do it we first have to create
    // an instance of DOMSource
    DOMSource source = new DOMSource(testDoc);

    // PrintStream will be responsible for writing
    // the text data to the file
    PrintStream ps = new PrintStream(file);
    StreamResult result = new StreamResult(ps);
View Full Code Here

    public static void printDocument(Document document, String fname){
        try{

            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer transformer = tf.newTransformer();
            DOMSource source = new DOMSource(document);
            StreamResult result;

            if (fname == null)
                result = new StreamResult(System.out);
            else
View Full Code Here

   *
   */
  public String toString() {
    StringWriter sresult = new StringWriter();
       try {
           DOMSource source = new DOMSource(getDOMrepresentation());
           StreamResult result = new StreamResult(sresult);
           Transformer trans = TransformerFactory.newInstance().newTransformer();
           trans.setOutputProperty(OutputKeys.INDENT, "yes");
           trans.transform(source, result);
          }
View Full Code Here

   * TODO This is untested.
   */
  public String toString() {
    StringWriter sresult = new StringWriter();
       try {
           DOMSource source = new DOMSource(getDOMrepresentation());
           StreamResult result = new StreamResult(sresult);
           Transformer trans = TransformerFactory.newInstance().newTransformer();
           trans.setOutputProperty(OutputKeys.INDENT, "yes");
           trans.transform(source, result);
          }
View Full Code Here

    {
      SVGCanvasProvider provider = new SVGCanvasProvider(false, orientation);
      barcode.generateBarcode(provider, message);
      Document svgDoc = provider.getDOM();

      Source source = new DOMSource(svgDoc);
      StringWriter outWriter = new StringWriter();
      Result output = new StreamResult(outWriter);
      Transformer transformer = TransformerFactory.newInstance()
          .newTransformer();
      transformer.transform(source, output);
View Full Code Here

        SaveSession ss = getSaveSession("UTF8", new File(file));
        VerifyingWriter ps = ss.getWriter();
        MODSDatabase md = new MODSDatabase(database, keySet);

        try {
            DOMSource source = new DOMSource(md.getDOMrepresentation());
            StreamResult result = new StreamResult(ps);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            trans.setOutputProperty(OutputKeys.INDENT, "yes");
            trans.transform(source, result);
        }
View Full Code Here

        MSBibDatabase md = new MSBibDatabase(database, keySet);

        // PS: DOES NOT SUPPORT EXPORTING ONLY A SET OF ENTRIES

        try {
            DOMSource source = new DOMSource(md.getDOMrepresentation());
            StreamResult result = new StreamResult(ps);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            trans.setOutputProperty(OutputKeys.INDENT, "yes");
            trans.transform(source, result);
        }
View Full Code Here

      }
      if (content == null)
         return null;

      // Get a parsable representation of this elements content
      DOMSource source = new DOMSource(content);
      TransformerFactory tFactory = TransformerFactory.newInstance();
      Transformer transformer = tFactory.newTransformer();
      StringWriter sw = new StringWriter();
      StreamResult result = new StreamResult(sw);
      transformer.transform(source, result);
View Full Code Here

TOP

Related Classes of javax.xml.transform.dom.DOMSource

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.