You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2005/01/04 16:58:58 UTC
cvs commit: xml-xerces/java/samples/sax Writer.java
ankitp 2005/01/04 07:58:57
Modified: java/samples/dom Writer.java
java/samples/sax Writer.java
Log:
add generate-synthetic-annotations option to samples
Revision Changes Path
1.14 +24 -1 xml-xerces/java/samples/dom/Writer.java
Index: Writer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/dom/Writer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Writer.java 16 Dec 2004 03:56:03 -0000 1.13
+++ Writer.java 4 Jan 2005 15:58:57 -0000 1.14
@@ -61,6 +61,9 @@
/** Validate schema annotations feature id (http://apache.org/xml/features/validate-annotations). */
protected static final String VALIDATE_ANNOTATIONS_ID = "http://apache.org/xml/features/validate-annotations";
+ /** Generate synthetic schema annotations feature id (http://apache.org/xml/features/generate-synthetic-annotations). */
+ protected static final String GENERATE_SYNTHETIC_ANNOTATIONS_ID = "http://apache.org/xml/features/generate-synthetic-annotations";
+
/** Dynamic validation feature id (http://apache.org/xml/features/validation/dynamic). */
protected static final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic";
@@ -90,6 +93,9 @@
/** Default validate schema annotations (false). */
protected static final boolean DEFAULT_VALIDATE_ANNOTATIONS = false;
+ /** Default generate synthetic schema annotations (false). */
+ protected static final boolean DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS = false;
+
/** Default dynamic validation support (false). */
protected static final boolean DEFAULT_DYNAMIC_VALIDATION = false;
@@ -452,6 +458,7 @@
boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING;
boolean validateAnnotations = DEFAULT_VALIDATE_ANNOTATIONS;
+ boolean generateSyntheticAnnotations = DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS;
boolean dynamicValidation = DEFAULT_DYNAMIC_VALIDATION;
boolean canonical = DEFAULT_CANONICAL;
@@ -501,6 +508,10 @@
validateAnnotations = option.equals("va");
continue;
}
+ if (option.equalsIgnoreCase("ga")) {
+ generateSyntheticAnnotations = option.equals("ga");
+ continue;
+ }
if (option.equalsIgnoreCase("dv")) {
dynamicValidation = option.equals("dv");
continue;
@@ -566,6 +577,12 @@
System.err.println("warning: Parser does not support feature ("+VALIDATE_ANNOTATIONS_ID+")");
}
try {
+ parser.setFeature(GENERATE_SYNTHETIC_ANNOTATIONS_ID, generateSyntheticAnnotations);
+ }
+ catch (SAXException e) {
+ System.err.println("warning: Parser does not support feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
+ }
+ try {
parser.setFeature(DYNAMIC_VALIDATION_FEATURE_ID, dynamicValidation);
}
catch (SAXException e) {
@@ -629,6 +646,8 @@
System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
System.err.println(" -va | -VA Turn on/off validation of schema annotations.");
System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
+ System.err.println(" -ga | -GA Turn on/off generation of synthetic schema annotations.");
+ System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
System.err.println(" -dv | -DV Turn on/off dynamic validation.");
System.err.println(" NOTE: Not supported by all parsers.");
System.err.println(" -c | -C Turn on/off Canonical XML output.");
@@ -652,6 +671,10 @@
System.err.println(DEFAULT_DYNAMIC_VALIDATION ? "on" : "off");
System.err.print(" Canonical: ");
System.err.println(DEFAULT_CANONICAL ? "on" : "off");
+ System.err.print(" Validate Annotations: ");
+ System.err.println(DEFAULT_VALIDATE_ANNOTATIONS ? "on" : "off");
+ System.err.print(" Generate Synthetic Annotations: ");
+ System.err.println(DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS ? "on" : "off");
} // printUsage()
1.14 +28 -2 xml-xerces/java/samples/sax/Writer.java
Index: Writer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/sax/Writer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Writer.java 16 Dec 2004 03:35:43 -0000 1.13
+++ Writer.java 4 Jan 2005 15:58:57 -0000 1.14
@@ -75,6 +75,9 @@
/** Validate schema annotations feature id (http://apache.org/xml/features/validate-annotations) */
protected static final String VALIDATE_ANNOTATIONS_ID = "http://apache.org/xml/features/validate-annotations";
+
+ /** Generate synthetic schema annotations feature id (http://apache.org/xml/features/generate-synthetic-annotations). */
+ protected static final String GENERATE_SYNTHETIC_ANNOTATIONS_ID = "http://apache.org/xml/features/generate-synthetic-annotations";
/** Dynamic validation feature id (http://apache.org/xml/features/validation/dynamic). */
protected static final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic";
@@ -113,6 +116,9 @@
/** Default validate schema annotations (false). */
protected static final boolean DEFAULT_VALIDATE_ANNOTATIONS = false;
+ /** Default generate synthetic schema annotations (false). */
+ protected static final boolean DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS = false;
+
/** Default dynamic validation support (false). */
protected static final boolean DEFAULT_DYNAMIC_VALIDATION = false;
@@ -543,6 +549,7 @@
boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION;
boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING;
boolean validateAnnotations = DEFAULT_VALIDATE_ANNOTATIONS;
+ boolean generateSyntheticAnnotations = DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS;
boolean dynamicValidation = DEFAULT_DYNAMIC_VALIDATION;
boolean canonical = DEFAULT_CANONICAL;
@@ -604,6 +611,10 @@
validateAnnotations = option.equals("va");
continue;
}
+ if (option.equalsIgnoreCase("ga")) {
+ generateSyntheticAnnotations = option.equals("ga");
+ continue;
+ }
if (option.equalsIgnoreCase("dv")) {
dynamicValidation = option.equals("dv");
continue;
@@ -682,12 +693,21 @@
parser.setFeature(VALIDATE_ANNOTATIONS_ID, validateAnnotations);
}
catch (SAXNotRecognizedException e) {
- System.err.println("warning: Parser does not support feature ("+VALIDATE_ANNOTATIONS_ID+")");
+ System.err.println("warning: Parser does not recognize feature ("+VALIDATE_ANNOTATIONS_ID+")");
}
catch (SAXNotSupportedException e) {
System.err.println("warning: Parser does not support feature ("+VALIDATE_ANNOTATIONS_ID+")");
}
try {
+ parser.setFeature(GENERATE_SYNTHETIC_ANNOTATIONS_ID, generateSyntheticAnnotations);
+ }
+ catch (SAXNotRecognizedException e) {
+ System.err.println("warning: Parser does not recognize feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
+ }
+ catch (SAXNotSupportedException e) {
+ System.err.println("warning: Parser does not support feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
+ }
+ try {
parser.setFeature(DYNAMIC_VALIDATION_FEATURE_ID, dynamicValidation);
}
catch (SAXNotRecognizedException e) {
@@ -765,6 +785,8 @@
System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
System.err.println(" -va | -VA Turn on/off validation of schema annotations.");
System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
+ System.err.println(" -ga | -GA Turn on/off generation of synthetic schema annotations.");
+ System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
System.err.println(" -dv | -DV Turn on/off dynamic validation.");
System.err.println(" NOTE: Not supported by all parsers.");
System.err.println(" -c | -C Turn on/off Canonical XML output.");
@@ -790,6 +812,10 @@
System.err.println(DEFAULT_DYNAMIC_VALIDATION ? "on" : "off");
System.err.print(" Canonical: ");
System.err.println(DEFAULT_CANONICAL ? "on" : "off");
+ System.err.print(" Validate Annotations: ");
+ System.err.println(DEFAULT_VALIDATE_ANNOTATIONS ? "on" : "off");
+ System.err.print(" Generate Synthetic Annotations: ");
+ System.err.println(DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS ? "on" : "off");
} // printUsage()
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org