cvs commit: xml-fop/examples/embedding/java/embedding ExampleDOM2PDF.java ExampleFO2PDF.java ExampleObj2PDF.java ExampleObj2XML.java ExampleSVG2PDF.java ExampleXML2FO.java ExampleXML2PDF.java

2004-04-14 Thread gmazza
gmazza  2004/04/14 15:57:10

  Modified:examples/embedding/java/embedding ExampleDOM2PDF.java
ExampleFO2PDF.java ExampleObj2PDF.java
ExampleObj2XML.java ExampleSVG2PDF.java
ExampleXML2FO.java ExampleXML2PDF.java
  Log:
  Used standard Java exception-printing method "printStackTrace(PrintStream)"
  instead of Avalon equivalent.
  
  Revision  ChangesPath
  1.6   +3 -5  xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java
  
  Index: ExampleDOM2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExampleDOM2PDF.java   1 Apr 2004 23:24:57 -   1.5
  +++ ExampleDOM2PDF.java   14 Apr 2004 22:57:10 -  1.6
  @@ -33,9 +33,6 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   
  -//Avalon
  -import org.apache.avalon.framework.ExceptionUtil;
  -
   // Commons-Logging
   import org.apache.commons.logging.impl.SimpleLog;
   
  @@ -141,8 +138,9 @@
   app.convertDOM2PDF(foDoc, pdffile);
   
   System.out.println("Success!");
  +
   } catch (Exception e) {
  -System.err.println(ExceptionUtil.printStackTrace(e));
  +e.printStackTrace(System.err);
   System.exit(-1);
   }
   }
  
  
  
  1.6   +1 -4  xml-fop/examples/embedding/java/embedding/ExampleFO2PDF.java
  
  Index: ExampleFO2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleFO2PDF.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExampleFO2PDF.java1 Apr 2004 23:24:57 -   1.5
  +++ ExampleFO2PDF.java14 Apr 2004 22:57:10 -  1.6
  @@ -27,9 +27,6 @@
   //SAX
   import org.xml.sax.InputSource;
   
  -//Avalon
  -import org.apache.avalon.framework.ExceptionUtil;
  -
   // Commons-Logging
   import org.apache.commons.logging.impl.SimpleLog;
   
  @@ -113,7 +110,7 @@
   
   System.out.println("Success!");
   } catch (Exception e) {
  -System.err.println(ExceptionUtil.printStackTrace(e));
  +e.printStackTrace(System.err);
   System.exit(-1);
   }
   }
  
  
  
  1.6   +1 -4  xml-fop/examples/embedding/java/embedding/ExampleObj2PDF.java
  
  Index: ExampleObj2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleObj2PDF.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExampleObj2PDF.java   1 Apr 2004 23:24:57 -   1.5
  +++ ExampleObj2PDF.java   14 Apr 2004 22:57:10 -  1.6
  @@ -32,9 +32,6 @@
   import javax.xml.transform.stream.StreamSource;
   import javax.xml.transform.sax.SAXResult;
   
  -//Avalon
  -import org.apache.avalon.framework.ExceptionUtil;
  -
   // Commons-Logging
   import org.apache.commons.logging.impl.SimpleLog;
   
  @@ -127,7 +124,7 @@
   
   System.out.println("Success!");
   } catch (Exception e) {
  -System.err.println(ExceptionUtil.printStackTrace(e));
  +e.printStackTrace(System.err);
   System.exit(-1);
   }
   }
  
  
  
  1.4   +1 -4  xml-fop/examples/embedding/java/embedding/ExampleObj2XML.java
  
  Index: ExampleObj2XML.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleObj2XML.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExampleObj2XML.java   27 Feb 2004 17:34:50 -  1.3
  +++ ExampleObj2XML.java   14 Apr 2004 22:57:10 -  1.4
  @@ -30,9 +30,6 @@
   import javax.xml.transform.Result;
   import javax.xml.transform.stream.StreamResult;
   
  -//Avalon
  -import org.apache.avalon.framework.ExceptionUtil;
  -
   import embedding.model.ProjectMember;
   import embedding.model.ProjectTeam;
   
  @@ -118,7 +115,7 @@
   
   System.out.println("Success!");
   } catch (Exception e) {
  -System.err.println(ExceptionUtil.printStackTrace(e));
  +e.printStackTrace(System.err);
   System.exit(-1);
   }
   }
  
  
  
  1.4   +1 -4  xml-fop/examples/embedding/java/embedding/ExampleSVG2PDF.java
  
  Index: ExampleSVG2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleSVG2PDF.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExampleSVG2PDF.java   27 Feb 2004 17

cvs commit: xml-fop/examples/embedding/java/embedding ExampleDOM2PDF.java ExampleFO2PDF.java ExampleObj2PDF.java ExampleXML2PDF.java

2004-04-01 Thread gmazza
gmazza  2004/04/01 15:24:57

  Modified:examples/embedding build.xml
   examples/embedding/java/embedding ExampleDOM2PDF.java
ExampleFO2PDF.java ExampleObj2PDF.java
ExampleXML2PDF.java
  Log:
  Updated examples to use Commons-Logging.
  
  Revision  ChangesPath
  1.5   +19 -0 xml-fop/examples/embedding/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/build.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- build.xml 27 Feb 2004 19:35:43 -  1.4
  +++ build.xml 1 Apr 2004 23:24:57 -   1.5
  @@ -39,6 +39,7 @@
   
   
   
  +


 
  @@ -113,6 +114,24 @@



  +   
  + 
  + 
  +   
  + 
  + 
  + 
  + 
  + 
  +   
  + 
  + 
  +   
  + 
  + 
  + 
  + 
  + 
  


  
  
  
  1.5   +12 -10xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java
  
  Index: ExampleDOM2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExampleDOM2PDF.java   27 Feb 2004 17:34:50 -  1.4
  +++ ExampleDOM2PDF.java   1 Apr 2004 23:24:57 -   1.5
  @@ -33,10 +33,11 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   
  -// Avalon
  +//Avalon
   import org.apache.avalon.framework.ExceptionUtil;
  -import org.apache.avalon.framework.logger.ConsoleLogger;
  -import org.apache.avalon.framework.logger.Logger;
  +
  +// Commons-Logging
  +import org.apache.commons.logging.impl.SimpleLog;
   
   //FOP
   import org.apache.fop.apps.Driver;
  @@ -60,18 +61,19 @@
*/
   public void convertDOM2PDF(Document xslfoDoc, File pdf) 
   throws IOException, FOPException {
  -//Construct driver
  +// Construct driver
   Driver driver = new Driver();
   
  -//Setup logger
  -Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  -driver.enableLogging(logger);
  +// Setup logger
  +SimpleLog logger = new SimpleLog("log");
  +logger.setLevel(SimpleLog.LOG_LEVEL_INFO);
  +driver.setLogger(logger);
   driver.initialize();
   
  -//Setup Renderer (output format)
  +// Setup Renderer (output format)
   driver.setRenderer(Driver.RENDER_PDF);
   
  -//Setup output
  +// Setup output
   OutputStream out = new java.io.FileOutputStream(pdf);
   out = new java.io.BufferedOutputStream(out);
   
  
  
  
  1.5   +10 -8 xml-fop/examples/embedding/java/embedding/ExampleFO2PDF.java
  
  Index: ExampleFO2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleFO2PDF.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExampleFO2PDF.java27 Feb 2004 17:34:50 -  1.4
  +++ ExampleFO2PDF.java1 Apr 2004 23:24:57 -   1.5
  @@ -29,8 +29,9 @@
   
   //Avalon
   import org.apache.avalon.framework.ExceptionUtil;
  -import org.apache.avalon.framework.logger.Logger;
  -import org.apache.avalon.framework.logger.ConsoleLogger;
  +
  +// Commons-Logging
  +import org.apache.commons.logging.impl.SimpleLog;
   
   //FOP
   import org.apache.fop.apps.Driver;
  @@ -50,18 +51,19 @@
*/
   public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException {
   
  -//Construct driver
  +// Construct driver
   Driver driver = new Driver();
   
  -//Setup logger
  -Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  -driver.enableLogging(logger);
  +// Setup logger
  +SimpleLog logger = new SimpleLog("log");
  +logger.setLevel(SimpleLog.LOG_LEVEL_INFO);
  +driver.setLogger(logger);
   driver.initialize();
   
  -//Setup Renderer (output format)
  +// Setup Renderer (output format)
   driver.setRenderer(Driver.RENDER_PDF);
   
  -//Setup output
  +// Setup output
   OutputStream out = new java.io.FileOutputStream(pdf);
   out = new java.io.BufferedOutputStream(out);
   try {
  
  
  
  1.5   +16 -14xml-fop/examples/embedding/java/embedding/ExampleObj2PDF.java
  
  Index: Exa

cvs commit: xml-fop/examples/embedding/java/embedding ExampleDOM2PDF.java

2004-01-09 Thread jeremias
jeremias2004/01/09 00:56:43

  Modified:examples/embedding/java/embedding ExampleDOM2PDF.java
  Log:
  Style, javadoc and tab character fixes
  
  Revision  ChangesPath
  1.3   +21 -15xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java
  
  Index: ExampleDOM2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExampleDOM2PDF.java   13 Aug 2003 23:19:57 -  1.2
  +++ ExampleDOM2PDF.java   9 Jan 2004 08:56:43 -   1.3
  @@ -4,7 +4,7 @@
*The Apache Software License, Version 1.1
* 
* 
  - * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 1999-2004 The Apache Software Foundation. All rights reserved.
* 
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
  @@ -62,7 +62,6 @@
   // DOM
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  -import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   
  @@ -86,7 +85,7 @@
   
   /**
* Converts a DOM Document to a PDF file using FOP.
  - * @param doc the DOM Document
  + * @param xslfoDoc the DOM Document
* @param pdf the target PDF file
* @throws IOException In case of an I/O problem
* @throws FOPException In case of a FOP problem
  @@ -166,7 +165,7 @@
   ele2 = foDoc.createElementNS(foNS, "fo:flow");
   ele1.appendChild(ele2);
   ele2.setAttributeNS(null, "flow-name", "xsl-region-body");
  -AddElement(ele2, "fo:block", "Hello World!");
  +addElement(ele2, "fo:block", "Hello World!");
   
   ExampleDOM2PDF app = new ExampleDOM2PDF();
   app.convertDOM2PDF(foDoc, pdffile);
  @@ -178,15 +177,22 @@
   }
   }
   
  - protected static void AddElement(Node parent, String newNodeName, 
  -String textVal)
  - {
  - if (textVal == null) return;  // use only with text nodes
  - Element newElement = 
  -parent.getOwnerDocument().createElementNS(foNS, newNodeName);
  - Text elementText = parent.getOwnerDocument().createTextNode(textVal);
  - newElement.appendChild(elementText);
  - parent.appendChild(newElement);
  - }
  +/**
  + * Adds an element to the DOM.
  + * @param parent parent node to attach the new element to
  + * @param newNodeName name of the new node
  + * @param textVal content of the element
  + */
  +protected static void addElement(Node parent, String newNodeName, 
  +String textVal) {
  +if (textVal == null) {
  +return;
  +}  // use only with text nodes
  +Element newElement = parent.getOwnerDocument().createElementNS(
  +foNS, newNodeName);
  +Text elementText = parent.getOwnerDocument().createTextNode(textVal);
  +newElement.appendChild(elementText);
  +parent.appendChild(newElement);
  +}
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/examples/embedding/java/embedding ExampleDOM2PDF.java

2003-08-14 Thread gmazza
gmazza  2003/08/13 16:19:57

  Modified:examples/embedding/java/embedding ExampleDOM2PDF.java
  Log:
  $Id$ added to get header printed at top of file.
  
  Revision  ChangesPath
  1.2   +1 -1  xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java
  
  Index: ExampleDOM2PDF.java
  ===
  RCS file: /home/cvs/xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExampleDOM2PDF.java   13 Aug 2003 23:16:14 -  1.1
  +++ ExampleDOM2PDF.java   13 Aug 2003 23:19:57 -  1.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id
  + * $Id$
* 
*The Apache Software License, Version 1.1
* 
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/examples/embedding/java/embedding ExampleDOM2PDF.java

2003-08-14 Thread gmazza
gmazza  2003/08/13 16:16:14

  Added:   examples/embedding/java/embedding ExampleDOM2PDF.java
  Log:
  Created a simple example using the DOM Level 2 API for testing/demonstrating FOP's
  DOM Document-processing capabilities.
  
  Revision  ChangesPath
  1.1  xml-fop/examples/embedding/java/embedding/ExampleDOM2PDF.java
  
  Index: ExampleDOM2PDF.java
  ===
  /*
   * $Id
   * 
   *The Apache Software License, Version 1.1
   * 
   * 
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   * 
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   * 
   * 1. Redistributions of source code must retain the above copyright notice,
   *this list of conditions and the following disclaimer.
   * 
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *this list of conditions and the following disclaimer in the documentation
   *and/or other materials provided with the distribution.
   * 
   * 3. The end-user documentation included with the redistribution, if any, must
   *include the following acknowledgment: "This product includes software
   *developed by the Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself, if
   *and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *endorse or promote products derived from this software without prior
   *written permission. For written permission, please contact
   *[EMAIL PROTECTED]
   * 
   * 5. Products derived from this software may not be called "Apache", nor may
   *"Apache" appear in their name, without prior written permission of the
   *Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   * 
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
   * Software Foundation, please see .
   */ 
  package embedding;
  
  //Java
  import java.io.File;
  import java.io.IOException;
  import java.io.OutputStream;
  
  //JAXP
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.DocumentBuilder;
  
  // DOM
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  import org.w3c.dom.Text;
  
  // Avalon
  import org.apache.avalon.framework.ExceptionUtil;
  import org.apache.avalon.framework.logger.ConsoleLogger;
  import org.apache.avalon.framework.logger.Logger;
  
  //FOP
  import org.apache.fop.apps.Driver;
  import org.apache.fop.apps.FOPException;
  
  /**
   * This class demonstrates the conversion of a DOM Document to PDF
   * using JAXP (XSLT) and FOP (XSL-FO).
   */
  public class ExampleDOM2PDF {
  
  /** xsl-fo namespace URI */
  protected static String foNS = "http://www.w3.org/1999/XSL/Format";;
  
  /**
   * Converts a DOM Document to a PDF file using FOP.
   * @param doc the DOM Document
   * @param pdf the target PDF file
   * @throws IOException In case of an I/O problem
   * @throws FOPException In case of a FOP problem
   */
  public void convertDOM2PDF(Document xslfoDoc, File pdf) 
  throws IOException, FOPException {
  //Construct driver
  Driver driver = new Driver();
  
  //Setup logger
  Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  driver.enableLogging(logger);
  driver.initialize();
  
  //Setup Renderer (output format)
  driver.setRenderer