You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/11/19 00:16:39 UTC

svn commit: r345598 - in /xerces/java/trunk/samples/xni: Counter.java DocumentTracer.java Writer.java

Author: mrglavas
Date: Fri Nov 18 15:16:34 2005
New Revision: 345598

URL: http://svn.apache.org/viewcvs?rev=345598&view=rev
Log:
Add honour-all-schemaLocations option to XNI samples.

Modified:
    xerces/java/trunk/samples/xni/Counter.java
    xerces/java/trunk/samples/xni/DocumentTracer.java
    xerces/java/trunk/samples/xni/Writer.java

Modified: xerces/java/trunk/samples/xni/Counter.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/samples/xni/Counter.java?rev=345598&r1=345597&r2=345598&view=diff
==============================================================================
--- xerces/java/trunk/samples/xni/Counter.java (original)
+++ xerces/java/trunk/samples/xni/Counter.java Fri Nov 18 15:16:34 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -80,6 +80,10 @@
     /** Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). */
     protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
         "http://apache.org/xml/features/validation/schema-full-checking";
+    
+    /** Honour all schema locations feature id (http://apache.org/xml/features/honour-all-schemaLocations). */
+    protected static final String HONOUR_ALL_SCHEMA_LOCATIONS_ID = 
+        "http://apache.org/xml/features/honour-all-schemaLocations";
 
     // default settings
 
@@ -104,6 +108,9 @@
 
     /** Default Schema full checking support (false). */
     protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false;
+    
+    /** Default honour all schema locations (false). */
+    protected static final boolean DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS = false;
 
     /** Default memory usage report (false). */
     protected static final boolean DEFAULT_MEMORY_USAGE = false;
@@ -357,6 +364,7 @@
         boolean validation = DEFAULT_VALIDATION;
         boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
         boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING;
+        boolean honourAllSchemaLocations = DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS;
         boolean memoryUsage = DEFAULT_MEMORY_USAGE;
         boolean tagginess = DEFAULT_TAGGINESS;
 
@@ -427,6 +435,10 @@
                     schemaFullChecking = option.equals("f");
                     continue;
                 }
+                if (option.equalsIgnoreCase("hs")) {
+                    honourAllSchemaLocations = option.equals("hs");
+                    continue;
+                }
                 if (option.equalsIgnoreCase("m")) {
                     memoryUsage = option.equals("m");
                     continue;
@@ -501,6 +513,14 @@
                     System.err.println("warning: Parser does not support feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")");
                 }
             }
+            try {
+                parserConfig.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, honourAllSchemaLocations);
+            }
+            catch (XMLConfigurationException e) {
+                if (e.getType() == XMLConfigurationException.NOT_SUPPORTED) {
+                    System.err.println("warning: Parser does not support feature ("+HONOUR_ALL_SCHEMA_LOCATIONS_ID+")");
+                }
+            }
 
             // parse file
             try {
@@ -560,6 +580,8 @@
         System.err.println("              NOTE: Not supported by all parser configurations.");
         System.err.println("  -f  | -F    Turn on/off Schema full checking.");
         System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
+        System.err.println("  -hs | -HS   Turn on/off honouring of all schema locations.");
+        System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
         System.err.println("  -m  | -M    Turn on/off memory usage report.");
         System.err.println("  -t  | -T    Turn on/off \"tagginess\" report.");
         System.err.println("  --rem text  Output user defined comment before next parse.");
@@ -579,6 +601,8 @@
         System.err.println(DEFAULT_SCHEMA_VALIDATION ? "on" : "off");
         System.err.print("  Schema full checking:     ");
         System.err.println(DEFAULT_SCHEMA_FULL_CHECKING ? "on" : "off");
+        System.err.print("  Honour all schema locations:     ");
+        System.err.println(DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS ? "on" : "off");
         System.err.print("  Memory:     ");
         System.err.println(DEFAULT_MEMORY_USAGE ? "on" : "off");
         System.err.print("  Tagginess:  ");

Modified: xerces/java/trunk/samples/xni/DocumentTracer.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/samples/xni/DocumentTracer.java?rev=345598&r1=345597&r2=345598&view=diff
==============================================================================
--- xerces/java/trunk/samples/xni/DocumentTracer.java (original)
+++ xerces/java/trunk/samples/xni/DocumentTracer.java Fri Nov 18 15:16:34 2005
@@ -73,6 +73,10 @@
     /** Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). */
     protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
         "http://apache.org/xml/features/validation/schema-full-checking";
+    
+    /** Honour all schema locations feature id (http://apache.org/xml/features/honour-all-schemaLocations). */
+    protected static final String HONOUR_ALL_SCHEMA_LOCATIONS_ID = 
+        "http://apache.org/xml/features/honour-all-schemaLocations";
 
     /** Character ref notification feature id (http://apache.org/xml/features/scanner/notify-char-refs). */
     protected static final String NOTIFY_CHAR_REFS_FEATURE_ID =
@@ -95,6 +99,9 @@
 
     /** Default Schema full checking support (false). */
     protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false;
+    
+    /** Default honour all schema locations (false). */
+    protected static final boolean DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS = false;
 
     /** Default character notifications (false). */
     protected static final boolean DEFAULT_NOTIFY_CHAR_REFS = false;
@@ -1372,6 +1379,7 @@
         boolean validation = DEFAULT_VALIDATION;
         boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
         boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING;
+        boolean honourAllSchemaLocations = DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS;
         boolean notifyCharRefs = DEFAULT_NOTIFY_CHAR_REFS;
 
         // process arguments
@@ -1415,6 +1423,10 @@
                     schemaFullChecking = option.equals("f");
                     continue;
                 }
+                if (option.equalsIgnoreCase("hs")) {
+                    honourAllSchemaLocations = option.equals("hs");
+                    continue;
+                }
                 if (option.equalsIgnoreCase("c")) {
                     notifyCharRefs = option.equals("c");
                     continue;
@@ -1472,6 +1484,14 @@
                 }
             }
             try {
+                parserConfig.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, honourAllSchemaLocations);
+            }
+            catch (XMLConfigurationException e) {
+                if (e.getType() == XMLConfigurationException.NOT_SUPPORTED) {
+                    System.err.println("warning: Parser does not support feature ("+HONOUR_ALL_SCHEMA_LOCATIONS_ID+")");
+                }
+            }
+            try {
                 parserConfig.setFeature(NOTIFY_CHAR_REFS_FEATURE_ID, notifyCharRefs);
             }
             catch (XMLConfigurationException e) {
@@ -1513,28 +1533,32 @@
         System.err.println();
 
         System.err.println("options:");
-        System.out.println("  -p name  Specify parser configuration by name.");
-        System.err.println("  -n | -N  Turn on/off namespace processing.");
-        System.err.println("  -v | -V  Turn on/off validation.");
-        System.err.println("  -s | -S  Turn on/off Schema validation support.");
-        System.err.println("           NOTE: Not supported by all parser configurations.");
-        System.err.println("  -f  | -F Turn on/off Schema full checking.");
-        System.err.println("           NOTE: Requires use of -s and not supported by all parsers.");
-        System.err.println("  -c | -C  Turn on/off character notifications");
-        System.err.println("  -h       This help screen.");
+        System.err.println("  -p name     Specify parser configuration by name.");
+        System.err.println("  -n | -N     Turn on/off namespace processing.");
+        System.err.println("  -v | -V     Turn on/off validation.");
+        System.err.println("  -s | -S     Turn on/off Schema validation support.");
+        System.err.println("              NOTE: Not supported by all parser configurations.");
+        System.err.println("  -f  | -F    Turn on/off Schema full checking.");
+        System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
+        System.err.println("  -hs | -HS   Turn on/off honouring of all schema locations.");
+        System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
+        System.err.println("  -c | -C     Turn on/off character notifications");
+        System.err.println("  -h          This help screen.");
         System.err.println();
 
         System.err.println("defaults:");
-        System.out.println("  Config:     "+DEFAULT_PARSER_CONFIG);
-        System.out.print("  Namespaces: ");
+        System.err.println("  Config:     "+DEFAULT_PARSER_CONFIG);
+        System.err.print("  Namespaces: ");
         System.err.println(DEFAULT_NAMESPACES ? "on" : "off");
-        System.out.print("  Validation: ");
+        System.err.print("  Validation: ");
         System.err.println(DEFAULT_VALIDATION ? "on" : "off");
-        System.out.print("  Schema:     ");
+        System.err.print("  Schema:     ");
         System.err.println(DEFAULT_SCHEMA_VALIDATION ? "on" : "off");
         System.err.print("  Schema full checking:     ");
         System.err.println(DEFAULT_SCHEMA_FULL_CHECKING ? "on" : "off");
-        System.out.print("  Char refs:  ");
+        System.err.print("  Honour all schema locations:     ");
+        System.err.println(DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS ? "on" : "off");
+        System.err.print("  Char refs:  ");
         System.err.println(DEFAULT_NOTIFY_CHAR_REFS ? "on" : "off" );
 
     } // printUsage()

Modified: xerces/java/trunk/samples/xni/Writer.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/samples/xni/Writer.java?rev=345598&r1=345597&r2=345598&view=diff
==============================================================================
--- xerces/java/trunk/samples/xni/Writer.java (original)
+++ xerces/java/trunk/samples/xni/Writer.java Fri Nov 18 15:16:34 2005
@@ -70,6 +70,10 @@
     /** Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). */
     protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID =
         "http://apache.org/xml/features/validation/schema-full-checking";
+    
+    /** Honour all schema locations feature id (http://apache.org/xml/features/honour-all-schemaLocations). */
+    protected static final String HONOUR_ALL_SCHEMA_LOCATIONS_ID = 
+        "http://apache.org/xml/features/honour-all-schemaLocations";
 
     // default settings
 
@@ -88,6 +92,9 @@
 
     /** Default Schema full checking support (false). */
     protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false;
+    
+    /** Default honour all schema locations (false). */
+    protected static final boolean DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS = false;
 
     /** Default canonical output (false). */
     protected static final boolean DEFAULT_CANONICAL = false;
@@ -451,6 +458,7 @@
         boolean validation = DEFAULT_VALIDATION;
         boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
         boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING;
+        boolean honourAllSchemaLocations = DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS;
         boolean canonical = DEFAULT_CANONICAL;
         boolean incremental = DEFAULT_INCREMENTAL;
 
@@ -500,6 +508,10 @@
                     schemaFullChecking = option.equals("f");
                     continue;
                 }
+                if (option.equalsIgnoreCase("hs")) {
+                    honourAllSchemaLocations = option.equals("hs");
+                    continue;
+                }
                 if (option.equalsIgnoreCase("c")) {
                     canonical = option.equals("c");
                     continue;
@@ -566,6 +578,14 @@
                     System.err.println("warning: Parser does not support feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")");
                 }
             }
+            try {
+                parserConfig.setFeature(HONOUR_ALL_SCHEMA_LOCATIONS_ID, honourAllSchemaLocations);
+            }
+            catch (XMLConfigurationException e) {
+                if (e.getType() == XMLConfigurationException.NOT_SUPPORTED) {
+                    System.err.println("warning: Parser does not support feature ("+HONOUR_ALL_SCHEMA_LOCATIONS_ID+")");
+                }
+            }
 
             // parse file
             try {
@@ -614,21 +634,23 @@
         System.err.println();
 
         System.err.println("options:");
-        System.err.println("  -p name  Select parser configuration by name.");
-        System.err.println("  -n | -N  Turn on/off namespace processing.");
-        System.err.println("  -v | -V  Turn on/off validation.");
-        System.err.println("  -s | -S  Turn on/off Schema validation support.");
-        System.err.println("           NOTE: Not supported by all parsers.");
-        System.err.println("  -f  | -F Turn on/off Schema full checking.");
-        System.err.println("           NOTE: Requires use of -s and not supported by all parsers.");
+        System.err.println("  -p name     Select parser configuration by name.");
+        System.err.println("  -n | -N     Turn on/off namespace processing.");
+        System.err.println("  -v | -V     Turn on/off validation.");
+        System.err.println("  -s | -S     Turn on/off Schema validation support.");
+        System.err.println("              NOTE: Not supported by all parsers.");
+        System.err.println("  -f  | -F    Turn on/off Schema full checking.");
+        System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
+        System.err.println("  -hs | -HS   Turn on/off honouring of all schema locations.");
+        System.err.println("              NOTE: Requires use of -s and not supported by all parsers.");
         /***
-        System.err.println("  -c | -C  Turn on/off Canonical XML output.");
-        System.err.println("           NOTE: This is not W3C canonical output.");
+        System.err.println("  -c | -C     Turn on/off Canonical XML output.");
+        System.err.println("              NOTE: This is not W3C canonical output.");
         /***/
-        System.err.println("  -i | -I  Incremental mode.");
-        System.err.println("           NOTE: This feature only works if the configuration used");
-        System.err.println("                 implements XMLPullParserConfiguration.");
-        System.err.println("  -h       This help screen.");
+        System.err.println("  -i | -I     Incremental mode.");
+        System.err.println("              NOTE: This feature only works if the configuration used");
+        System.err.println("                    implements XMLPullParserConfiguration.");
+        System.err.println("  -h          This help screen.");
         System.err.println();
 
         System.err.println("defaults:");
@@ -641,6 +663,8 @@
         System.err.println(DEFAULT_SCHEMA_VALIDATION ? "on" : "off");
         System.err.print("  Schema full checking:     ");
         System.err.println(DEFAULT_SCHEMA_FULL_CHECKING ? "on" : "off");
+        System.err.print("  Honour all schema locations:     ");
+        System.err.println(DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS ? "on" : "off");
         /***
         System.err.print("  Canonical:  ");
         System.err.println(DEFAULT_CANONICAL ? "on" : "off");



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org