You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ar...@locus.apache.org on 2000/07/11 04:27:05 UTC

cvs commit: xml-fop/src/org/apache/fop/apps Driver.java

arved       00/07/10 19:27:05

  Modified:    src/org/apache/fop/apps Driver.java
  Log:
  Expresses SAX2 support
  
  Revision  Changes    Path
  1.9       +19 -16    xml-fop/src/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Driver.java	2000/06/27 22:13:03	1.8
  +++ Driver.java	2000/07/11 02:27:05	1.9
  @@ -1,4 +1,4 @@
  -/*-- $Id: Driver.java,v 1.8 2000/06/27 22:13:03 fotis Exp $ -- 
  +/*-- $Id: Driver.java,v 1.9 2000/07/11 02:27:05 arved Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -66,11 +66,11 @@
   import org.w3c.dom.Attr;
   
   // SAX
  -import org.xml.sax.DocumentHandler;
  +import org.xml.sax.ContentHandler;
   import org.xml.sax.InputSource;
  -import org.xml.sax.Parser;
  +import org.xml.sax.XMLReader;
   import org.xml.sax.SAXException;
  -import org.xml.sax.helpers.AttributeListImpl;
  +import org.xml.sax.helpers.AttributesImpl;
   
   // Java
   import java.io.PrintWriter;
  @@ -214,7 +214,7 @@
        * SAX parser. A good example is an XSLT engine that fires SAX
        * events but isn't a SAX Parser itself.
        */
  -    public DocumentHandler getDocumentHandler() {
  +    public ContentHandler getContentHandler() {
   	return this.treeBuilder;
       }
   
  @@ -222,9 +222,10 @@
        * build the formatting object tree using the given SAX Parser and
        * SAX InputSource
        */
  -    public void buildFOTree(Parser parser, InputSource source)
  -	throws FOPException {
  -	parser.setDocumentHandler(this.treeBuilder);
  +    public void buildFOTree(XMLReader parser, InputSource source)
  +		throws FOPException {
  +
  +	parser.setContentHandler(this.treeBuilder);
   	try {
   	    parser.parse(source);
   	} catch (SAXException e) {
  @@ -246,12 +247,12 @@
   	/* most of this code is modified from John Cowan's */
   
   	Node currentNode;
  -	AttributeListImpl currentAtts;
  +	AttributesImpl currentAtts;
   	
   	/* temporary array for making Strings into character arrays */
   	char[] array = null;
   
  -	currentAtts = new AttributeListImpl();
  +	currentAtts = new AttributesImpl();
   	
   	/* start at the document element */
   	currentNode = document;
  @@ -283,13 +284,15 @@
   		    NamedNodeMap map = currentNode.getAttributes();
   		    currentAtts.clear();
   		    for (int i = map.getLength() - 1; i >= 0; i--) {
  -			Attr att = (Attr)(map.item(i));
  -			currentAtts.addAttribute(att.getName(),
  -						 "CDATA",
  -						 att.getValue()); 
  +			Attr att = (Attr)map.item(i);
  +			currentAtts.addAttribute("",
  +                         att.getName(),
  +                         "",
  +                         "CDATA",
  +                         att.getValue());
   		    }
   		    this.treeBuilder.startElement(
  -			currentNode.getNodeName(), currentAtts);
  +			"", currentNode.getNodeName(), "", currentAtts);
   		    break;
   		}
   		
  @@ -306,7 +309,7 @@
   			break;
   		    case Node.ELEMENT_NODE:
   			this.treeBuilder.endElement(
  -			    currentNode.getNodeName());
  +			    "", currentNode.getNodeName(), "" );
   			break;
   		    }