Author: mrglavas
Date: Fri Oct  7 15:04:17 2011
New Revision: 1180064

URL: http://svn.apache.org/viewvc?rev=1180064&view=rev
Log:
Correct indentation to improve readability of the code.

Modified:
    xml/commons/trunk/java/src/org/apache/xml/resolver/apps/XParseError.java
    xml/commons/trunk/java/src/org/apache/xml/resolver/apps/resolver.java
    xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xparse.java
    xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xread.java

Modified: 
xml/commons/trunk/java/src/org/apache/xml/resolver/apps/XParseError.java
URL: 
http://svn.apache.org/viewvc/xml/commons/trunk/java/src/org/apache/xml/resolver/apps/XParseError.java?rev=1180064&r1=1180063&r2=1180064&view=diff
==============================================================================
--- xml/commons/trunk/java/src/org/apache/xml/resolver/apps/XParseError.java 
(original)
+++ xml/commons/trunk/java/src/org/apache/xml/resolver/apps/XParseError.java 
Fri Oct  7 15:04:17 2011
@@ -39,107 +39,107 @@ import org.xml.sax.SAXParseException;
  * @version 1.0
  */
 public class XParseError implements ErrorHandler {
-  /** Show errors? */
-  private boolean showErrors = true;
+    /** Show errors? */
+    private boolean showErrors = true;
 
-  /** Show warnings? */
-  private boolean showWarnings = false;
+    /** Show warnings? */
+    private boolean showWarnings = false;
 
-  /** How many messages should be presented? */
-  private int maxMessages = 10;
+    /** How many messages should be presented? */
+    private int maxMessages = 10;
 
-  /** The number of fatal errors seen so far. */
-  private int fatalCount = 0;
+    /** The number of fatal errors seen so far. */
+    private int fatalCount = 0;
 
-  /** The number of errors seen so far. */
-  private int errorCount = 0;
+    /** The number of errors seen so far. */
+    private int errorCount = 0;
 
-  /** The number of warnings seen so far. */
-  private int warningCount = 0;
+    /** The number of warnings seen so far. */
+    private int warningCount = 0;
 
-  /** The base URI of the running application. */
-  private String baseURI = "";
+    /** The base URI of the running application. */
+    private String baseURI = "";
 
-  /** Constructor */
-  public XParseError(boolean errors, boolean warnings) {
-    showErrors = errors;
-    showWarnings = warnings;
+    /** Constructor */
+    public XParseError(boolean errors, boolean warnings) {
+        showErrors = errors;
+        showWarnings = warnings;
 
-    try {
-      URL url = FileURL.makeURL("basename");
-      baseURI = url.toString();
-    } catch (MalformedURLException mue) {
-      // nop;
+        try {
+            URL url = FileURL.makeURL("basename");
+            baseURI = url.toString();
+        } catch (MalformedURLException mue) {
+            // nop;
+        }
     }
-  }
 
-  /** Return the error count */
-  public int getErrorCount() {
-    return errorCount;
-  }
-
-  /** Return the fatal error count */
-  public int getFatalCount() {
-    return fatalCount;
-  }
+    /** Return the error count */
+    public int getErrorCount() {
+        return errorCount;
+    }
 
-  /** Return the warning count */
-  public int getWarningCount() {
-    return warningCount;
-  }
+    /** Return the fatal error count */
+    public int getFatalCount() {
+        return fatalCount;
+    }
 
-  /** Return the number of messages to display */
-  public int getMaxMessages() {
-    return maxMessages;
-  }
+    /** Return the warning count */
+    public int getWarningCount() {
+        return warningCount;
+    }
 
-  /** Set the number of messages to display */
-  public void setMaxMessages(int max) {
-    maxMessages = max;
-  }
+    /** Return the number of messages to display */
+    public int getMaxMessages() {
+        return maxMessages;
+    }
 
-  /** SAX2 API */
-  public void error(SAXParseException exception) {
-    errorCount++;
-    if (showErrors && (errorCount+warningCount < maxMessages)) {
-       message("Error", exception);
+    /** Set the number of messages to display */
+    public void setMaxMessages(int max) {
+        maxMessages = max;
     }
-  }
 
-  /** SAX2 API */
-  public void fatalError(SAXParseException exception) {
-    errorCount++;
-    fatalCount++;
-    if (showErrors && (errorCount+warningCount < maxMessages)) {
-       message("Fatal error", exception);
+    /** SAX2 API */
+    public void error(SAXParseException exception) {
+        errorCount++;
+        if (showErrors && (errorCount+warningCount < maxMessages)) {
+            message("Error", exception);
+        }
     }
-  }
 
-  /** SAX2 API */
-  public void warning(SAXParseException exception) {
-    warningCount++;
-    if (showWarnings && (errorCount+warningCount < maxMessages)) {
-       message("Warning", exception);
+    /** SAX2 API */
+    public void fatalError(SAXParseException exception) {
+        errorCount++;
+        fatalCount++;
+        if (showErrors && (errorCount+warningCount < maxMessages)) {
+            message("Fatal error", exception);
+        }
     }
-  }
 
-  /** Display a message to the user */
-  private void message(String type, SAXParseException exception) {
-    String filename = exception.getSystemId();
-    if (filename.startsWith(baseURI)) {
-      filename = filename.substring(baseURI.length());
+    /** SAX2 API */
+    public void warning(SAXParseException exception) {
+        warningCount++;
+        if (showWarnings && (errorCount+warningCount < maxMessages)) {
+            message("Warning", exception);
+        }
     }
 
-    System.out.print(type
-                    + ":"
-                    + filename
-                    + ":"
-                    + exception.getLineNumber());
+    /** Display a message to the user */
+    private void message(String type, SAXParseException exception) {
+        String filename = exception.getSystemId();
+        if (filename.startsWith(baseURI)) {
+            filename = filename.substring(baseURI.length());
+        }
 
-    if (exception.getColumnNumber() > 0) {
-      System.out.print(":" + exception.getColumnNumber());
-    }
+        System.out.print(type
+                + ":"
+                + filename
+                + ":"
+                + exception.getLineNumber());
 
-    System.out.println(":" + exception.getMessage());
-  }
+        if (exception.getColumnNumber() > 0) {
+            System.out.print(":" + exception.getColumnNumber());
+        }
+
+        System.out.println(":" + exception.getMessage());
+    }
 }

Modified: xml/commons/trunk/java/src/org/apache/xml/resolver/apps/resolver.java
URL: 
http://svn.apache.org/viewvc/xml/commons/trunk/java/src/org/apache/xml/resolver/apps/resolver.java?rev=1180064&r1=1180063&r2=1180064&view=diff
==============================================================================
--- xml/commons/trunk/java/src/org/apache/xml/resolver/apps/resolver.java 
(original)
+++ xml/commons/trunk/java/src/org/apache/xml/resolver/apps/resolver.java Fri 
Oct  7 15:04:17 2011
@@ -72,219 +72,219 @@ import org.apache.xml.resolver.tools.Cat
  *
  * @version 1.0 */
 public class resolver {
-  private static Debug debug = CatalogManager.getStaticManager().debug;
+    private static Debug debug = CatalogManager.getStaticManager().debug;
 
-  /** The main entry point */
-  public static void main (String[] args)
+    /** The main entry point */
+    public static void main (String[] args)
     throws FileNotFoundException, IOException {
 
-    int     debuglevel   = 0;
-    Vector  catalogFiles = new Vector();
-    int     resType      = 0;
-    String  resTypeStr   = null;
-    String  name         = null;
-    String  publicId     = null;
-    String  systemId     = null;
-    String  uri          = null;
-    boolean absoluteSystem = false;
-
-    for (int i=0; i<args.length; i++) {
-      if (args[i].equals("-c")) {
-       ++i;
-       catalogFiles.add(args[i]);
-       continue;
-      }
-
-      if (args[i].equals("-p")) {
-       ++i;
-       publicId = args[i];
-       continue;
-      }
-
-      if (args[i].equals("-s")) {
-       ++i;
-       systemId = args[i];
-       continue;
-      }
-
-      if (args[i].equals("-n")) {
-       ++i;
-       name = args[i];
-       continue;
-      }
-
-      if (args[i].equals("-u")) {
-       ++i;
-       uri = args[i];
-       continue;
-      }
-
-      if (args[i].equals("-a")) {
-       absoluteSystem = true;
-       continue;
-      }
-
-      if (args[i].equals("-d")) {
-       ++i;
-       String debugstr = args[i];
-       try {
-         debuglevel = Integer.parseInt(debugstr);
-         if (debuglevel > 0) {
-           debug.setDebug(debuglevel);
-         }
-       } catch (Exception e) {
-         // nop
-       }
-       continue;
-      }
+        int     debuglevel   = 0;
+        Vector  catalogFiles = new Vector();
+        int     resType      = 0;
+        String  resTypeStr   = null;
+        String  name         = null;
+        String  publicId     = null;
+        String  systemId     = null;
+        String  uri          = null;
+        boolean absoluteSystem = false;
+
+        for (int i=0; i<args.length; i++) {
+            if (args[i].equals("-c")) {
+                ++i;
+                catalogFiles.add(args[i]);
+                continue;
+            }
+
+            if (args[i].equals("-p")) {
+                ++i;
+                publicId = args[i];
+                continue;
+            }
+
+            if (args[i].equals("-s")) {
+                ++i;
+                systemId = args[i];
+                continue;
+            }
+
+            if (args[i].equals("-n")) {
+                ++i;
+                name = args[i];
+                continue;
+            }
+
+            if (args[i].equals("-u")) {
+                ++i;
+                uri = args[i];
+                continue;
+            }
+
+            if (args[i].equals("-a")) {
+                absoluteSystem = true;
+                continue;
+            }
+
+            if (args[i].equals("-d")) {
+                ++i;
+                String debugstr = args[i];
+                try {
+                    debuglevel = Integer.parseInt(debugstr);
+                    if (debuglevel > 0) {
+                        debug.setDebug(debuglevel);
+                    }
+                } catch (Exception e) {
+                    // nop
+                }
+                continue;
+            }
+
+            resTypeStr = args[i];
+        }
+
+        if (resTypeStr == null) {
+            usage();
+        }
+
+        if (resTypeStr.equalsIgnoreCase("doctype")) {
+            resType = Catalog.DOCTYPE;
+            if (publicId == null && systemId == null) {
+                System.out.println("DOCTYPE requires public or system 
identifier.");
+                usage();
+            }
+        } else if (resTypeStr.equalsIgnoreCase("document")) {
+            resType = Catalog.DOCUMENT;
+        } else if (resTypeStr.equalsIgnoreCase("entity")) {
+            resType = Catalog.ENTITY;
+            if (publicId == null && systemId == null && name == null) {
+                System.out.println("ENTITY requires name or public or system 
identifier.");
+                usage();
+            }
+        } else if (resTypeStr.equalsIgnoreCase("notation")) {
+            resType = Catalog.NOTATION;
+            if (publicId == null && systemId == null && name == null) {
+                System.out.println("NOTATION requires name or public or system 
identifier.");
+                usage();
+            }
+        } else if (resTypeStr.equalsIgnoreCase("public")) {
+            resType = Catalog.PUBLIC;
+            if (publicId == null) {
+                System.out.println("PUBLIC requires public identifier.");
+                usage();
+            }
+        } else if (resTypeStr.equalsIgnoreCase("system")) {
+            resType = Catalog.SYSTEM;
+            if (systemId == null) {
+                System.out.println("SYSTEM requires system identifier.");
+                usage();
+            }
+        } else if (resTypeStr.equalsIgnoreCase("uri")) {
+            resType = Catalog.URI;
+            if (uri == null) {
+                System.out.println("URI requires a uri.");
+                usage();
+            }
+        } else {
+            System.out.println(resTypeStr + " is not a recognized keyword.");
+            usage();
+        }
+
+        if (absoluteSystem) {
+            URL base = null;
+            URL sysid = null;
+
+            // Calculate the appropriate BASE URI
+            try {
+                // tack on a basename because URLs point to files not dirs
+                base = FileURL.makeURL("basename");
+            } catch (MalformedURLException e) {
+                String userdir = System.getProperty("user.dir");
+                userdir = userdir.replace('\\', '/');
+                debug.message(1, "Malformed URL on cwd", userdir);
+                base = null;
+            }
+
+            try {
+                sysid = new URL(base, systemId);
+                systemId = sysid.toString();
+            } catch (MalformedURLException e) {
+                try {
+                    sysid = new URL("file:///" + systemId);
+                } catch (MalformedURLException e2) {
+                    debug.message(1, "Malformed URL on system id", systemId);
+                }
+            }
+        }
+
+        CatalogResolver catalogResolver = new CatalogResolver();
+        Catalog resolver = catalogResolver.getCatalog();
+
+        for (int count = 0; count < catalogFiles.size(); count++) {
+            String file = (String) catalogFiles.elementAt(count);
+            resolver.parseCatalog(file);
+        }
+        String result = null;
+
+        if (resType == Catalog.DOCTYPE) {
+            System.out.println("Resolve DOCTYPE (name, publicid, systemid):");
+            if (name != null) { System.out.println("       name: " + name); }
+            if (publicId != null) { System.out.println("  public id: " + 
publicId); }
+            if (systemId != null) { System.out.println("  system id: " + 
systemId); }
+            if (uri != null) { System.out.println("        uri: " + uri); }
+            result = resolver.resolveDoctype(name, publicId, systemId);
+        } else if (resType == Catalog.DOCUMENT) {
+            System.out.println("Resolve DOCUMENT ():");
+            result = resolver.resolveDocument();
+        } else if (resType == Catalog.ENTITY) {
+            System.out.println("Resolve ENTITY (name, publicid, systemid):");
+            if (name != null) { System.out.println("       name: " + name); }
+            if (publicId != null) { System.out.println("  public id: " + 
publicId); }
+            if (systemId != null) { System.out.println("  system id: " + 
systemId); }
+            result = resolver.resolveEntity(name, publicId, systemId);
+        } else if (resType == Catalog.NOTATION) {
+            System.out.println("Resolve NOTATION (name, publicid, systemid):");
+            if (name != null) { System.out.println("       name: " + name); }
+            if (publicId != null) { System.out.println("  public id: " + 
publicId); }
+            if (systemId != null) { System.out.println("  system id: " + 
systemId); }
+            result = resolver.resolveNotation(name, publicId, systemId);
+        } else if (resType == Catalog.PUBLIC) {
+            System.out.println("Resolve PUBLIC (publicid, systemid):");
+            if (publicId != null) { System.out.println("  public id: " + 
publicId); }
+            if (systemId != null) { System.out.println("  system id: " + 
systemId); }
+            result = resolver.resolvePublic(publicId, systemId);
+        } else if (resType == Catalog.SYSTEM) {
+            System.out.println("Resolve SYSTEM (systemid):");
+            if (systemId != null) { System.out.println("  system id: " + 
systemId); }
+            result = resolver.resolveSystem(systemId);
+        } else if (resType == Catalog.URI) {
+            System.out.println("Resolve URI (uri):");
+            if (uri != null) { System.out.println("        uri: " + uri); }
+            result = resolver.resolveURI(uri);
+        } else {
+            System.out.println("resType is wrong!? This can't happen!");
+            usage();
+        }
+
+        System.out.println("Result: " + result);
+    }
+
+    public static void usage() {
+        System.out.println("Usage: resolver [options] keyword");
+        System.out.println("");
+        System.out.println("Where:");
+        System.out.println("");
+        System.out.println("-c catalogfile  Loads a particular catalog file.");
+        System.out.println("-n name         Sets the name.");
+        System.out.println("-p publicId     Sets the public identifier.");
+        System.out.println("-s systemId     Sets the system identifier.");
+        System.out.println("-a              Makes the system URI absolute 
before resolution");
+        System.out.println("-u uri          Sets the URI.");
+        System.out.println("-d integer      Set the debug level.");
+        System.out.println("keyword         Identifies the type of resolution 
to perform:");
+        System.out.println("                doctype, document, entity, 
notation, public, system,");
+        System.out.println("                or uri.");
 
-      resTypeStr = args[i];
+        System.exit(1);
     }
-
-    if (resTypeStr == null) {
-      usage();
-    }
-
-    if (resTypeStr.equalsIgnoreCase("doctype")) {
-      resType = Catalog.DOCTYPE;
-      if (publicId == null && systemId == null) {
-       System.out.println("DOCTYPE requires public or system identifier.");
-       usage();
-      }
-    } else if (resTypeStr.equalsIgnoreCase("document")) {
-      resType = Catalog.DOCUMENT;
-    } else if (resTypeStr.equalsIgnoreCase("entity")) {
-      resType = Catalog.ENTITY;
-      if (publicId == null && systemId == null && name == null) {
-       System.out.println("ENTITY requires name or public or system 
identifier.");
-       usage();
-      }
-    } else if (resTypeStr.equalsIgnoreCase("notation")) {
-      resType = Catalog.NOTATION;
-      if (publicId == null && systemId == null && name == null) {
-       System.out.println("NOTATION requires name or public or system 
identifier.");
-       usage();
-      }
-    } else if (resTypeStr.equalsIgnoreCase("public")) {
-      resType = Catalog.PUBLIC;
-      if (publicId == null) {
-       System.out.println("PUBLIC requires public identifier.");
-       usage();
-      }
-    } else if (resTypeStr.equalsIgnoreCase("system")) {
-      resType = Catalog.SYSTEM;
-      if (systemId == null) {
-       System.out.println("SYSTEM requires system identifier.");
-       usage();
-      }
-    } else if (resTypeStr.equalsIgnoreCase("uri")) {
-      resType = Catalog.URI;
-      if (uri == null) {
-       System.out.println("URI requires a uri.");
-       usage();
-      }
-    } else {
-      System.out.println(resTypeStr + " is not a recognized keyword.");
-      usage();
-    }
-
-    if (absoluteSystem) {
-      URL base = null;
-      URL sysid = null;
-
-      // Calculate the appropriate BASE URI
-      try {
-       // tack on a basename because URLs point to files not dirs
-       base = FileURL.makeURL("basename");
-      } catch (MalformedURLException e) {
-       String userdir = System.getProperty("user.dir");
-       userdir = userdir.replace('\\', '/');
-       debug.message(1, "Malformed URL on cwd", userdir);
-       base = null;
-      }
-
-      try {
-       sysid = new URL(base, systemId);
-       systemId = sysid.toString();
-      } catch (MalformedURLException e) {
-       try {
-         sysid = new URL("file:///" + systemId);
-       } catch (MalformedURLException e2) {
-         debug.message(1, "Malformed URL on system id", systemId);
-       }
-      }
-    }
-
-    CatalogResolver catalogResolver = new CatalogResolver();
-    Catalog resolver = catalogResolver.getCatalog();
-
-    for (int count = 0; count < catalogFiles.size(); count++) {
-      String file = (String) catalogFiles.elementAt(count);
-      resolver.parseCatalog(file);
-    }
-    String result = null;
-
-    if (resType == Catalog.DOCTYPE) {
-      System.out.println("Resolve DOCTYPE (name, publicid, systemid):");
-      if (name != null) { System.out.println("       name: " + name); }
-      if (publicId != null) { System.out.println("  public id: " + publicId); }
-      if (systemId != null) { System.out.println("  system id: " + systemId); }
-      if (uri != null) { System.out.println("        uri: " + uri); }
-      result = resolver.resolveDoctype(name, publicId, systemId);
-    } else if (resType == Catalog.DOCUMENT) {
-      System.out.println("Resolve DOCUMENT ():");
-      result = resolver.resolveDocument();
-    } else if (resType == Catalog.ENTITY) {
-      System.out.println("Resolve ENTITY (name, publicid, systemid):");
-      if (name != null) { System.out.println("       name: " + name); }
-      if (publicId != null) { System.out.println("  public id: " + publicId); }
-      if (systemId != null) { System.out.println("  system id: " + systemId); }
-      result = resolver.resolveEntity(name, publicId, systemId);
-    } else if (resType == Catalog.NOTATION) {
-      System.out.println("Resolve NOTATION (name, publicid, systemid):");
-      if (name != null) { System.out.println("       name: " + name); }
-      if (publicId != null) { System.out.println("  public id: " + publicId); }
-      if (systemId != null) { System.out.println("  system id: " + systemId); }
-      result = resolver.resolveNotation(name, publicId, systemId);
-    } else if (resType == Catalog.PUBLIC) {
-      System.out.println("Resolve PUBLIC (publicid, systemid):");
-      if (publicId != null) { System.out.println("  public id: " + publicId); }
-      if (systemId != null) { System.out.println("  system id: " + systemId); }
-      result = resolver.resolvePublic(publicId, systemId);
-    } else if (resType == Catalog.SYSTEM) {
-      System.out.println("Resolve SYSTEM (systemid):");
-      if (systemId != null) { System.out.println("  system id: " + systemId); }
-      result = resolver.resolveSystem(systemId);
-    } else if (resType == Catalog.URI) {
-      System.out.println("Resolve URI (uri):");
-      if (uri != null) { System.out.println("        uri: " + uri); }
-      result = resolver.resolveURI(uri);
-    } else {
-      System.out.println("resType is wrong!? This can't happen!");
-      usage();
-    }
-
-    System.out.println("Result: " + result);
-  }
-
-  public static void usage() {
-    System.out.println("Usage: resolver [options] keyword");
-    System.out.println("");
-    System.out.println("Where:");
-    System.out.println("");
-    System.out.println("-c catalogfile  Loads a particular catalog file.");
-    System.out.println("-n name         Sets the name.");
-    System.out.println("-p publicId     Sets the public identifier.");
-    System.out.println("-s systemId     Sets the system identifier.");
-    System.out.println("-a              Makes the system URI absolute before 
resolution");
-    System.out.println("-u uri          Sets the URI.");
-    System.out.println("-d integer      Set the debug level.");
-    System.out.println("keyword         Identifies the type of resolution to 
perform:");
-    System.out.println("                doctype, document, entity, notation, 
public, system,");
-    System.out.println("                or uri.");
-
-    System.exit(1);
-  }
 }
 
 

Modified: xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xparse.java
URL: 
http://svn.apache.org/viewvc/xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xparse.java?rev=1180064&r1=1180063&r2=1180064&view=diff
==============================================================================
--- xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xparse.java 
(original)
+++ xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xparse.java Fri Oct 
 7 15:04:17 2011
@@ -73,185 +73,185 @@ import org.xml.sax.SAXException;
  * @version 1.0
  */
 public class xparse {
-  private static Debug debug = CatalogManager.getStaticManager().debug;
+    private static Debug debug = CatalogManager.getStaticManager().debug;
 
-  /** The main entry point */
-  public static void main (String[] args)
+    /** The main entry point */
+    public static void main (String[] args)
     throws FileNotFoundException, IOException {
 
-    String  xmlfile    = null;
-    int     debuglevel = 0;
-    int     maxErrs    = 10;
-    boolean nsAware    = true;
-    boolean validating = true;
-    boolean showWarnings = (debuglevel > 2);
-    boolean showErrors = true;
-    Vector catalogFiles = new Vector();
-
-    for (int i=0; i<args.length; i++) {
-      if (args[i].equals("-c")) {
-       ++i;
-       catalogFiles.add(args[i]);
-       continue;
-      }
-
-      if (args[i].equals("-w")) {
-       validating = false;
-       continue;
-      }
-
-      if (args[i].equals("-v")) {
-       validating = true;
-       continue;
-      }
-
-      if (args[i].equals("-n")) {
-       nsAware = false;
-       continue;
-      }
-
-      if (args[i].equals("-N")) {
-       nsAware = true;
-       continue;
-      }
-
-      if (args[i].equals("-d")) {
-       ++i;
-       String debugstr = args[i];
-       try {
-         debuglevel = Integer.parseInt(debugstr);
-         if (debuglevel >= 0) {
-           debug.setDebug(debuglevel);
-           showWarnings = (debuglevel > 2);
-         }
-       } catch (Exception e) {
-         // nop
-       }
-       continue;
-      }
-
-      if (args[i].equals("-E")) {
-       ++i;
-       String errstr = args[i];
-       try {
-         int errs = Integer.parseInt(errstr);
-         if (errs >= 0) {
-           maxErrs = errs;
-         }
-       } catch (Exception e) {
-         // nop
-       }
-       continue;
-      }
-
-      xmlfile = args[i];
-    }
-
-    if (xmlfile == null) {
-      System.out.println("Usage: org.apache.xml.resolver.apps.xparse [opts] 
xmlfile");
-      System.exit(1);
-    }
-
-    ResolvingParser.validating = validating;
-    ResolvingParser.namespaceAware = nsAware;
-    ResolvingParser reader = new ResolvingParser();
-    Catalog catalog = reader.getCatalog();
-
-    for (int count = 0; count < catalogFiles.size(); count++) {
-      String file = (String) catalogFiles.elementAt(count);
-      catalog.parseCatalog(file);
-    }
-
-    XParseError xpe = new XParseError(showErrors, showWarnings);
-    xpe.setMaxMessages(maxErrs);
-    reader.setErrorHandler(xpe);
-
-    String parseType = validating ? "validating" : "well-formed";
-    String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
-    if (maxErrs > 0) {
-      System.out.println("Attempting "
-                        + parseType
-                        + ", "
-                        + nsType
-                        + " parse");
-    }
-
-    Date startTime = new Date();
-
-    try {
-      reader.parse(xmlfile);
-    } catch (SAXException sx) {
-      System.out.println("SAX Exception: " + sx);
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-
-    Date endTime = new Date();
-
-    long millisec = endTime.getTime() - startTime.getTime();
-    long secs = 0;
-    long mins = 0;
-    long hours = 0;
-
-    if (millisec > 1000) {
-      secs = millisec / 1000;
-      millisec = millisec % 1000;
-    }
-
-    if (secs > 60) {
-      mins = secs / 60;
-      secs = secs % 60;
-    }
-
-    if (mins > 60) {
-      hours = mins / 60;
-      mins = mins % 60;
-    }
-
-    if (maxErrs > 0) {
-      System.out.print("Parse ");
-      if (xpe.getFatalCount() > 0) {
-       System.out.print("failed ");
-      } else {
-       System.out.print("succeeded ");
-       System.out.print("(");
-       if (hours > 0) {
-         System.out.print(hours + ":");
-       }
-       if (hours > 0 || mins > 0) {
-         System.out.print(mins + ":");
-       }
-       System.out.print(secs + "." + millisec);
-       System.out.print(") ");
-      }
-      System.out.print("with ");
-
-      int errCount = xpe.getErrorCount();
-      int warnCount = xpe.getWarningCount();
-
-      if (errCount > 0) {
-       System.out.print(errCount + " error");
-       System.out.print(errCount > 1 ? "s" : "");
-       System.out.print(" and ");
-      } else {
-       System.out.print("no errors and ");
-      }
-
-      if (warnCount > 0) {
-       System.out.print(warnCount + " warning");
-       System.out.print(warnCount > 1 ? "s" : "");
-       System.out.print(".");
-      } else {
-       System.out.print("no warnings.");
-      }
-
-      System.out.println("");
-    }
-
-    if (xpe.getErrorCount() > 0) {
-      System.exit(1);
+        String  xmlfile    = null;
+        int     debuglevel = 0;
+        int     maxErrs    = 10;
+        boolean nsAware    = true;
+        boolean validating = true;
+        boolean showWarnings = (debuglevel > 2);
+        boolean showErrors = true;
+        Vector catalogFiles = new Vector();
+
+        for (int i=0; i<args.length; i++) {
+            if (args[i].equals("-c")) {
+                ++i;
+                catalogFiles.add(args[i]);
+                continue;
+            }
+
+            if (args[i].equals("-w")) {
+                validating = false;
+                continue;
+            }
+
+            if (args[i].equals("-v")) {
+                validating = true;
+                continue;
+            }
+
+            if (args[i].equals("-n")) {
+                nsAware = false;
+                continue;
+            }
+
+            if (args[i].equals("-N")) {
+                nsAware = true;
+                continue;
+            }
+
+            if (args[i].equals("-d")) {
+                ++i;
+                String debugstr = args[i];
+                try {
+                    debuglevel = Integer.parseInt(debugstr);
+                    if (debuglevel >= 0) {
+                        debug.setDebug(debuglevel);
+                        showWarnings = (debuglevel > 2);
+                    }
+                } catch (Exception e) {
+                    // nop
+                }
+                continue;
+            }
+
+            if (args[i].equals("-E")) {
+                ++i;
+                String errstr = args[i];
+                try {
+                    int errs = Integer.parseInt(errstr);
+                    if (errs >= 0) {
+                        maxErrs = errs;
+                    }
+                } catch (Exception e) {
+                    // nop
+                }
+                continue;
+            }
+
+            xmlfile = args[i];
+        }
+
+        if (xmlfile == null) {
+            System.out.println("Usage: org.apache.xml.resolver.apps.xparse 
[opts] xmlfile");
+            System.exit(1);
+        }
+
+        ResolvingParser.validating = validating;
+        ResolvingParser.namespaceAware = nsAware;
+        ResolvingParser reader = new ResolvingParser();
+        Catalog catalog = reader.getCatalog();
+
+        for (int count = 0; count < catalogFiles.size(); count++) {
+            String file = (String) catalogFiles.elementAt(count);
+            catalog.parseCatalog(file);
+        }
+
+        XParseError xpe = new XParseError(showErrors, showWarnings);
+        xpe.setMaxMessages(maxErrs);
+        reader.setErrorHandler(xpe);
+
+        String parseType = validating ? "validating" : "well-formed";
+        String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
+        if (maxErrs > 0) {
+            System.out.println("Attempting "
+                    + parseType
+                    + ", "
+                    + nsType
+                    + " parse");
+        }
+
+        Date startTime = new Date();
+
+        try {
+            reader.parse(xmlfile);
+        } catch (SAXException sx) {
+            System.out.println("SAX Exception: " + sx);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        Date endTime = new Date();
+
+        long millisec = endTime.getTime() - startTime.getTime();
+        long secs = 0;
+        long mins = 0;
+        long hours = 0;
+
+        if (millisec > 1000) {
+            secs = millisec / 1000;
+            millisec = millisec % 1000;
+        }
+
+        if (secs > 60) {
+            mins = secs / 60;
+            secs = secs % 60;
+        }
+
+        if (mins > 60) {
+            hours = mins / 60;
+            mins = mins % 60;
+        }
+
+        if (maxErrs > 0) {
+            System.out.print("Parse ");
+            if (xpe.getFatalCount() > 0) {
+                System.out.print("failed ");
+            } else {
+                System.out.print("succeeded ");
+                System.out.print("(");
+                if (hours > 0) {
+                    System.out.print(hours + ":");
+                }
+                if (hours > 0 || mins > 0) {
+                    System.out.print(mins + ":");
+                }
+                System.out.print(secs + "." + millisec);
+                System.out.print(") ");
+            }
+            System.out.print("with ");
+
+            int errCount = xpe.getErrorCount();
+            int warnCount = xpe.getWarningCount();
+
+            if (errCount > 0) {
+                System.out.print(errCount + " error");
+                System.out.print(errCount > 1 ? "s" : "");
+                System.out.print(" and ");
+            } else {
+                System.out.print("no errors and ");
+            }
+
+            if (warnCount > 0) {
+                System.out.print(warnCount + " warning");
+                System.out.print(warnCount > 1 ? "s" : "");
+                System.out.print(".");
+            } else {
+                System.out.print("no warnings.");
+            }
+
+            System.out.println("");
+        }
+
+        if (xpe.getErrorCount() > 0) {
+            System.exit(1);
+        }
     }
-  }
 }
 
 

Modified: xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xread.java
URL: 
http://svn.apache.org/viewvc/xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xread.java?rev=1180064&r1=1180063&r2=1180064&view=diff
==============================================================================
--- xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xread.java 
(original)
+++ xml/commons/trunk/java/src/org/apache/xml/resolver/apps/xread.java Fri Oct  
7 15:04:17 2011
@@ -73,200 +73,200 @@ import org.xml.sax.SAXException;
  */
 public class xread
 {
-  private static Debug debug = CatalogManager.getStaticManager().debug;
+    private static Debug debug = CatalogManager.getStaticManager().debug;
 
-  /** The main entry point */
-  public static void main (String[] args)
+    /** The main entry point */
+    public static void main (String[] args)
     throws FileNotFoundException, IOException {
 
-    String  xmlfile    = null;
-    int     debuglevel = 0;
-    int     maxErrs    = 10;
-    boolean nsAware    = true;
-    boolean validating = true;
-    boolean useSchema  = false;
-    boolean showWarnings = (debuglevel > 2);
-    boolean showErrors = true;
-    Vector catalogFiles = new Vector();
-
-    for (int i=0; i<args.length; i++) {
-      if (args[i].equals("-c")) {
-       ++i;
-       catalogFiles.add(args[i]);
-       continue;
-      }
-
-      if (args[i].equals("-w")) {
-       validating = false;
-       continue;
-      }
-
-      if (args[i].equals("-v")) {
-       validating = true;
-       continue;
-      }
-
-      if (args[i].equals("-s")) {
-       useSchema = true;
-       continue;
-      }
-
-      if (args[i].equals("-n")) {
-       nsAware = false;
-       continue;
-      }
-
-      if (args[i].equals("-N")) {
-       nsAware = true;
-       continue;
-      }
-
-      if (args[i].equals("-d")) {
-       ++i;
-       String debugstr = args[i];
-       try {
-         debuglevel = Integer.parseInt(debugstr);
-         if (debuglevel >= 0) {
-           debug.setDebug(debuglevel);
-           showWarnings = (debuglevel > 2);
-         }
-       } catch (Exception e) {
-         // nop
-       }
-       continue;
-      }
-
-      if (args[i].equals("-E")) {
-       ++i;
-       String errstr = args[i];
-       try {
-         int errs = Integer.parseInt(errstr);
-         if (errs >= 0) {
-           maxErrs = errs;
-         }
-       } catch (Exception e) {
-         // nop
-       }
-       continue;
-      }
-
-      xmlfile = args[i];
-    }
-
-    if (xmlfile == null) {
-      System.out.println("Usage: org.apache.xml.resolver.apps.xread [opts] 
xmlfile");
-      System.exit(1);
-    }
-
-    ResolvingXMLReader reader = new ResolvingXMLReader();
-
-    try {
-      reader.setFeature("http://xml.org/sax/features/namespaces";, nsAware);
-      reader.setFeature("http://xml.org/sax/features/validation";, validating);
-      if (useSchema) {
-       reader.setFeature("http://apache.org/xml/features/validation/schema";, 
true);
-      }
-    } catch (SAXException e) {
-      // nop;
-    }
-
-    Catalog catalog = reader.getCatalog();
-
-    for (int count = 0; count < catalogFiles.size(); count++) {
-      String file = (String) catalogFiles.elementAt(count);
-      catalog.parseCatalog(file);
-    }
-
-    XParseError xpe = new XParseError(showErrors, showWarnings);
-    xpe.setMaxMessages(maxErrs);
-    reader.setErrorHandler(xpe);
-
-    String parseType = validating ? "validating" : "well-formed";
-    String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
-    if (maxErrs > 0) {
-      System.out.println("Attempting "
-                        + parseType
-                        + ", "
-                        + nsType
-                        + " parse");
-    }
-
-    Date startTime = new Date();
-
-    try {
-      reader.parse(xmlfile);
-    } catch (SAXException sx) {
-      System.out.println("SAX Exception: " + sx);
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-
-    Date endTime = new Date();
-
-    long millisec = endTime.getTime() - startTime.getTime();
-    long secs = 0;
-    long mins = 0;
-    long hours = 0;
-
-    if (millisec > 1000) {
-      secs = millisec / 1000;
-      millisec = millisec % 1000;
-    }
-
-    if (secs > 60) {
-      mins = secs / 60;
-      secs = secs % 60;
-    }
-
-    if (mins > 60) {
-      hours = mins / 60;
-      mins = mins % 60;
-    }
-
-    if (maxErrs > 0) {
-      System.out.print("Parse ");
-      if (xpe.getFatalCount() > 0) {
-       System.out.print("failed ");
-      } else {
-       System.out.print("succeeded ");
-       System.out.print("(");
-       if (hours > 0) {
-         System.out.print(hours + ":");
-       }
-       if (hours > 0 || mins > 0) {
-         System.out.print(mins + ":");
-       }
-       System.out.print(secs + "." + millisec);
-       System.out.print(") ");
-      }
-      System.out.print("with ");
-
-      int errCount = xpe.getErrorCount();
-      int warnCount = xpe.getWarningCount();
-
-      if (errCount > 0) {
-       System.out.print(errCount + " error");
-       System.out.print(errCount > 1 ? "s" : "");
-       System.out.print(" and ");
-      } else {
-       System.out.print("no errors and ");
-      }
-
-      if (warnCount > 0) {
-       System.out.print(warnCount + " warning");
-       System.out.print(warnCount > 1 ? "s" : "");
-       System.out.print(".");
-      } else {
-       System.out.print("no warnings.");
-      }
-
-      System.out.println("");
-    }
-
-    if (xpe.getErrorCount() > 0) {
-      System.exit(1);
+        String  xmlfile    = null;
+        int     debuglevel = 0;
+        int     maxErrs    = 10;
+        boolean nsAware    = true;
+        boolean validating = true;
+        boolean useSchema  = false;
+        boolean showWarnings = (debuglevel > 2);
+        boolean showErrors = true;
+        Vector catalogFiles = new Vector();
+
+        for (int i=0; i<args.length; i++) {
+            if (args[i].equals("-c")) {
+                ++i;
+                catalogFiles.add(args[i]);
+                continue;
+            }
+
+            if (args[i].equals("-w")) {
+                validating = false;
+                continue;
+            }
+
+            if (args[i].equals("-v")) {
+                validating = true;
+                continue;
+            }
+
+            if (args[i].equals("-s")) {
+                useSchema = true;
+                continue;
+            }
+
+            if (args[i].equals("-n")) {
+                nsAware = false;
+                continue;
+            }
+
+            if (args[i].equals("-N")) {
+                nsAware = true;
+                continue;
+            }
+
+            if (args[i].equals("-d")) {
+                ++i;
+                String debugstr = args[i];
+                try {
+                    debuglevel = Integer.parseInt(debugstr);
+                    if (debuglevel >= 0) {
+                        debug.setDebug(debuglevel);
+                        showWarnings = (debuglevel > 2);
+                    }
+                } catch (Exception e) {
+                    // nop
+                }
+                continue;
+            }
+
+            if (args[i].equals("-E")) {
+                ++i;
+                String errstr = args[i];
+                try {
+                    int errs = Integer.parseInt(errstr);
+                    if (errs >= 0) {
+                        maxErrs = errs;
+                    }
+                } catch (Exception e) {
+                    // nop
+                }
+                continue;
+            }
+
+            xmlfile = args[i];
+        }
+
+        if (xmlfile == null) {
+            System.out.println("Usage: org.apache.xml.resolver.apps.xread 
[opts] xmlfile");
+            System.exit(1);
+        }
+
+        ResolvingXMLReader reader = new ResolvingXMLReader();
+
+        try {
+            reader.setFeature("http://xml.org/sax/features/namespaces";, 
nsAware);
+            reader.setFeature("http://xml.org/sax/features/validation";, 
validating);
+            if (useSchema) {
+                
reader.setFeature("http://apache.org/xml/features/validation/schema";, true);
+            }
+        } catch (SAXException e) {
+            // nop;
+        }
+
+        Catalog catalog = reader.getCatalog();
+
+        for (int count = 0; count < catalogFiles.size(); count++) {
+            String file = (String) catalogFiles.elementAt(count);
+            catalog.parseCatalog(file);
+        }
+
+        XParseError xpe = new XParseError(showErrors, showWarnings);
+        xpe.setMaxMessages(maxErrs);
+        reader.setErrorHandler(xpe);
+
+        String parseType = validating ? "validating" : "well-formed";
+        String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
+        if (maxErrs > 0) {
+            System.out.println("Attempting "
+                    + parseType
+                    + ", "
+                    + nsType
+                    + " parse");
+        }
+
+        Date startTime = new Date();
+
+        try {
+            reader.parse(xmlfile);
+        } catch (SAXException sx) {
+            System.out.println("SAX Exception: " + sx);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        Date endTime = new Date();
+
+        long millisec = endTime.getTime() - startTime.getTime();
+        long secs = 0;
+        long mins = 0;
+        long hours = 0;
+
+        if (millisec > 1000) {
+            secs = millisec / 1000;
+            millisec = millisec % 1000;
+        }
+
+        if (secs > 60) {
+            mins = secs / 60;
+            secs = secs % 60;
+        }
+
+        if (mins > 60) {
+            hours = mins / 60;
+            mins = mins % 60;
+        }
+
+        if (maxErrs > 0) {
+            System.out.print("Parse ");
+            if (xpe.getFatalCount() > 0) {
+                System.out.print("failed ");
+            } else {
+                System.out.print("succeeded ");
+                System.out.print("(");
+                if (hours > 0) {
+                    System.out.print(hours + ":");
+                }
+                if (hours > 0 || mins > 0) {
+                    System.out.print(mins + ":");
+                }
+                System.out.print(secs + "." + millisec);
+                System.out.print(") ");
+            }
+            System.out.print("with ");
+
+            int errCount = xpe.getErrorCount();
+            int warnCount = xpe.getWarningCount();
+
+            if (errCount > 0) {
+                System.out.print(errCount + " error");
+                System.out.print(errCount > 1 ? "s" : "");
+                System.out.print(" and ");
+            } else {
+                System.out.print("no errors and ");
+            }
+
+            if (warnCount > 0) {
+                System.out.print(warnCount + " warning");
+                System.out.print(warnCount > 1 ? "s" : "");
+                System.out.print(".");
+            } else {
+                System.out.print("no warnings.");
+            }
+
+            System.out.println("");
+        }
+
+        if (xpe.getErrorCount() > 0) {
+            System.exit(1);
+        }
     }
-  }
 }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to