commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1130927 - /commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java
Date Fri, 03 Jun 2011 07:51:28 GMT
Author: simonetripodi
Date: Fri Jun  3 07:51:28 2011
New Revision: 1130927

URL: http://svn.apache.org/viewvc?rev=1130927&view=rev
Log:
sample moved to EDLS, loading using the proper XML module 

Modified:
    commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java

Modified: commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java?rev=1130927&r1=1130926&r2=1130927&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java
(original)
+++ commons/sandbox/digester3/trunk/src/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Main.java
Fri Jun  3 07:51:28 2011
@@ -17,11 +17,13 @@ package org.apache.commons.digester3.exa
  * limitations under the License.
  */ 
 
-import org.apache.commons.digester3.Digester;
-import org.apache.commons.digester3.xmlrules.DigesterLoader;
-import org.xml.sax.InputSource;
 import java.net.URL;
 
+import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
+
+import org.apache.commons.digester3.Digester;
+import org.apache.commons.digester3.xmlrules.FromXmlRulesModule;
+
 /**
  * A simple program to demonstrate the basic functionality of the
  * Commons Digester module with the xmlrules extension.
@@ -63,18 +65,21 @@ public class Main
             System.exit( -1 );
         }
 
-        String rulesfileName = args[0];
+        final String rulesfileName = args[0];
         String datafileName = args[1];
 
         // Create a Digester instance which has been initialised with
         // rules loaded from the specified file.
-        URL rulesURL = ClassLoader.getSystemResource( rulesfileName );
-        if ( rulesURL == null )
+        Digester d = newLoader( new FromXmlRulesModule()
         {
-            System.out.println( "Unable to find rules file." );
-            System.exit( -1 );
-        }
-        Digester d = DigesterLoader.createDigester( rulesURL );
+
+            @Override
+            protected void loadRules()
+            {
+                loadXMLRules( rulesfileName );
+            }
+
+        } ).newDigester();
 
         // Prime the digester stack with an object for rules to
         // operate on. Note that it is quite common for "this"



Mime
View raw message