[jsword-svn] r1297 - trunk/common/src/main/java/org/crosswire/common/xml

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Wed Apr 25 12:05:08 MST 2007


Author: dmsmith
Date: 2007-04-25 12:05:07 -0700 (Wed, 25 Apr 2007)
New Revision: 1297

Modified:
   trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
   trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java
Log:
Fixed a bug in the xml validation parser.

Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java	2007-04-25 19:02:56 UTC (rev 1296)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java	2007-04-25 19:05:07 UTC (rev 1297)
@@ -95,7 +95,7 @@
         for (int i = 0; i < argv.length; i++)
         {
             String arg = argv[i];
-            if (arg.charAt(0) == '=')
+            if (arg.charAt(0) == '-')
             {
                 String option = arg.substring(1);
                 String key = option.toLowerCase(Locale.ENGLISH);

Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java	2007-04-25 19:02:56 UTC (rev 1296)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java	2007-04-25 19:05:07 UTC (rev 1297)
@@ -106,9 +106,9 @@
                     {
                         System.err.println("error: Missing argument to -p option."); //$NON-NLS-1$
                     }
-                    String parserName = argv[i];
+                    parserName = argv[i];
 
-                    createParser(parserName);
+                    createParser();
                     continue;
                 }
                 if ("a".equals(option)) //$NON-NLS-1$
@@ -118,9 +118,9 @@
                     {
                         System.err.println("error: Missing argument to -a option."); //$NON-NLS-1$
                     }
-                    String adapterName = argv[i];
+                    adapterName = argv[i];
 
-                    createAdapter(adapterName);
+                    createAdapter();
                     continue;
                 }
             }
@@ -131,8 +131,8 @@
 
     private void bind()
     {
-        createParser(DEFAULT_PARSER_NAME);
-        createAdapter(DEFAULT_HANDLER_NAME);
+        createParser();
+        createAdapter();
 
         // Now that we have a parser and a handler
         // make the parser use them.
@@ -141,7 +141,7 @@
 
     }
 
-    private void createParser(String parserName)
+    private void createParser()
     {
         if (parser != null)
         {
@@ -159,7 +159,7 @@
 
     }
 
-    private void createAdapter(String adapterName)
+    private void createAdapter()
     {
         if (adapter != null)
         {
@@ -216,7 +216,9 @@
         // parse file
         try
         {
+            System.out.println("Parsing with the following:"); //$NON-NLS-1$            printActual();
             parser.parse(xmlFile);
+            System.out.println("Done parsing."); //$NON-NLS-1$
         }
         catch (SAXException e)
         {
@@ -266,6 +268,13 @@
         System.err.println(new XMLFeatureSet().toString());
     }
 
+    public void printActual()
+    {
+        System.err.println("Parser:     " + parserName); //$NON-NLS-1$
+        System.err.println("Handler:    " + adapterName); //$NON-NLS-1$
+        System.err.println(new XMLFeatureSet().toString());
+    }
+
     // property ids
 
     /**
@@ -284,7 +293,9 @@
     private static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$
     private static final String DEFAULT_HANDLER_NAME = "org.crosswire.common.xml.XMLHandlerAdapter"; //$NON-NLS-1$
 
+    private String parserName = DEFAULT_PARSER_NAME;
     private XMLReader parser;
+    private String adapterName = DEFAULT_HANDLER_NAME;
     private XMLHandlerAdapter adapter;
     private XMLFeatureSet features;
 }




More information about the jsword-svn mailing list