commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons/digester/src/java/org/apache/commons/digester Digester.java
Date Wed, 31 Jul 2002 11:06:47 GMT
jstrachan    2002/07/31 04:06:47

  Modified:    digester/src/java/org/apache/commons/digester Digester.java
  Log:
  Patched the Digester so that it can be used easily as a SAX ContentHandler as an alternative
to calling the parse() methods.
  
  The patch ensures that the configure() method is called when used on a SAX stream as well
as adding a new getRoot() method that can be used to extract the parsed object after the SAX
events have been streamed into the digester
  
  Revision  Changes    Path
  1.57      +23 -8     jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java
  
  Index: Digester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Digester.java	29 Jul 2002 21:05:15 -0000	1.56
  +++ Digester.java	31 Jul 2002 11:06:46 -0000	1.57
  @@ -896,7 +896,7 @@
                       new String(buffer, start, len) + ")");
           }
   
  -        ;	// No processing required
  +        ;   // No processing required
   
       }
   
  @@ -916,7 +916,7 @@
               saxLog.debug("processingInstruction('" + target + "','" + data + "')");
           }
   
  -        ;	// No processing is required
  +        ;   // No processing is required
   
       }
   
  @@ -966,8 +966,10 @@
               saxLog.debug("startDocument()");
           }
   
  -        ; // No processing required
  -
  +        // ensure that the digester is properly configured, as 
  +        // the digester could be used as a SAX ContentHandler
  +        // rather than via the parse() methods.
  +        configure();
       }
   
   
  @@ -1931,6 +1933,19 @@
   
       }
   
  +
  +    /**
  +     * When the Digester is being used as a SAXContentHandler, 
  +     * this method allows you to access the root object that has been
  +     * created after parsing.
  +     * 
  +     * @return the root object that has been created after parsing
  +     *  or null if the digester has not parsed any XML yet.
  +     */
  +    public Object getRoot() {
  +        return root;
  +    }
  +    
   
       // ------------------------------------------------ Parameter Stack Methods
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message