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:
parent
e238b84fd0
commit
43682ad7a5
@ -90,6 +90,8 @@ import org.apache.xml.resolver.helpers.Debug;
|
|||||||
* <dd>Perform a well-formed parse, not a validating parse.</dd>
|
* <dd>Perform a well-formed parse, not a validating parse.</dd>
|
||||||
* <dt><code>-v</code> (the default)</dt>
|
* <dt><code>-v</code> (the default)</dt>
|
||||||
* <dd>Perform a validating parse.</dd>
|
* <dd>Perform a validating parse.</dd>
|
||||||
|
* <dt><code>-s</code></dt>
|
||||||
|
* <dd>Enable W3C XML Schema validation.</dd>
|
||||||
* <dt><code>-n</code></dt>
|
* <dt><code>-n</code></dt>
|
||||||
* <dd>Perform a namespace-ignorant parse.</dd>
|
* <dd>Perform a namespace-ignorant parse.</dd>
|
||||||
* <dt><code>-N</code> (the default)</dt>
|
* <dt><code>-N</code> (the default)</dt>
|
||||||
@ -123,6 +125,7 @@ public class xread
|
|||||||
int maxErrs = 10;
|
int maxErrs = 10;
|
||||||
boolean nsAware = true;
|
boolean nsAware = true;
|
||||||
boolean validating = true;
|
boolean validating = true;
|
||||||
|
boolean useSchema = false;
|
||||||
boolean showWarnings = (debuglevel > 2);
|
boolean showWarnings = (debuglevel > 2);
|
||||||
boolean showErrors = true;
|
boolean showErrors = true;
|
||||||
Vector catalogFiles = new Vector();
|
Vector catalogFiles = new Vector();
|
||||||
@ -144,6 +147,11 @@ public class xread
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args[i].equals("-s")) {
|
||||||
|
useSchema = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (args[i].equals("-n")) {
|
if (args[i].equals("-n")) {
|
||||||
nsAware = false;
|
nsAware = false;
|
||||||
continue;
|
continue;
|
||||||
@ -196,6 +204,9 @@ public class xread
|
|||||||
try {
|
try {
|
||||||
reader.setFeature("http://xml.org/sax/features/namespaces", nsAware);
|
reader.setFeature("http://xml.org/sax/features/namespaces", nsAware);
|
||||||
reader.setFeature("http://xml.org/sax/features/validation", validating);
|
reader.setFeature("http://xml.org/sax/features/validation", validating);
|
||||||
|
if (useSchema) {
|
||||||
|
reader.setFeature("http://apache.org/xml/features/validation/schema", true);
|
||||||
|
}
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
// nop;
|
// nop;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user