Support validation with XML Schema

git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ndw 2005-04-12 20:24:15 +00:00
parent e238b84fd0
commit 43682ad7a5

View File

@ -90,6 +90,8 @@ import org.apache.xml.resolver.helpers.Debug;
* <dd>Perform a well-formed parse, not a validating parse.</dd>
* <dt><code>-v</code> (the default)</dt>
* <dd>Perform a validating parse.</dd>
* <dt><code>-s</code></dt>
* <dd>Enable W3C XML Schema validation.</dd>
* <dt><code>-n</code></dt>
* <dd>Perform a namespace-ignorant parse.</dd>
* <dt><code>-N</code> (the default)</dt>
@ -123,6 +125,7 @@ public class xread
int maxErrs = 10;
boolean nsAware = true;
boolean validating = true;
boolean useSchema = false;
boolean showWarnings = (debuglevel > 2);
boolean showErrors = true;
Vector catalogFiles = new Vector();
@ -144,6 +147,11 @@ public class xread
continue;
}
if (args[i].equals("-s")) {
useSchema = true;
continue;
}
if (args[i].equals("-n")) {
nsAware = false;
continue;
@ -196,6 +204,9 @@ public class xread
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;
}