public class AppSchemaValidator extends Object
SchemaResolver
.Modifier and Type | Method and Description |
---|---|
static AppSchemaValidator |
buildValidator()
Construct an
AppSchemaValidator that performs schema validation against schemas found
on the classpath using the convention described in SchemaResolver.getSimpleHttpResourcePath(java.net.URI) . |
static AppSchemaValidator |
buildValidator(SchemaCatalog catalog)
Construct an
AppSchemaValidator that performs schema validation against schemas found
using an SchemaResolver with a SchemaCatalog . |
static AppSchemaValidator |
buildValidator(SchemaResolver resolver)
Construct an
AppSchemaValidator that performs schema validation against schemas found
using an SchemaResolver . |
void |
checkForFailures()
Throw a
RuntimeException if the validator has found any failures. |
List<String> |
getFailures()
Return the list of failures found during parsing.
|
boolean |
isFailOnWarning()
Are validation warnings considered failures?
|
void |
parse(InputStream input)
Parse an XML instance document read from an
InputStream , recording any validation
failures failures. |
void |
setFailOnWarning(boolean failOnWarning)
Should validation warnings be considered failures?
|
static void |
validate(InputStream input,
SchemaCatalog catalog)
Perform schema validation of an XML instance document read from an input stream against
schemas found on the classpath using the convention described in
SchemaResolver.getSimpleHttpResourcePath(java.net.URI) . |
static void |
validate(String xml,
SchemaCatalog catalog)
Perform schema validation of an XML instance document in a string against schemas found on
the classpath using the convention described in
SchemaResolver.getSimpleHttpResourcePath(java.net.URI) . |
static void |
validateResource(String name,
SchemaCatalog catalog)
Perform schema validation of an XML instance document read from a classpath resource against
schemas found on the classpath using the convention described in
SchemaResolver.getSimpleHttpResourcePath(java.net.URI) . |
public boolean isFailOnWarning()
public void setFailOnWarning(boolean failOnWarning)
public void parse(InputStream input)
InputStream
, recording any validation
failures failures.input
- stream from which XML instance document is readpublic void checkForFailures()
RuntimeException
if the validator has found any failures. The exception
detail contains the failure messages.public static AppSchemaValidator buildValidator()
AppSchemaValidator
that performs schema validation against schemas found
on the classpath using the convention described in SchemaResolver.getSimpleHttpResourcePath(java.net.URI)
.public static AppSchemaValidator buildValidator(SchemaResolver resolver)
AppSchemaValidator
that performs schema validation against schemas found
using an SchemaResolver
.resolver
- the resolver used to find schemaspublic static AppSchemaValidator buildValidator(SchemaCatalog catalog)
AppSchemaValidator
that performs schema validation against schemas found
using an SchemaResolver
with a SchemaCatalog
.catalog
- SchemaCatalogpublic static void validateResource(String name, SchemaCatalog catalog)
SchemaResolver.getSimpleHttpResourcePath(java.net.URI)
.
If validation fails, a RuntimeException
is thrown containing details of all
failures.
name
- resource name of XML instance documentcatalog
- SchemaCatalog to aide local schema resolution or nullpublic static void validate(String xml, SchemaCatalog catalog)
SchemaResolver.getSimpleHttpResourcePath(java.net.URI)
.
If validation fails, a RuntimeException
is thrown containing details of all
failures.
xml
- string containing XML instance documentcatalog
- SchemaCatalog to aide local schema resolution or nullpublic static void validate(InputStream input, SchemaCatalog catalog)
SchemaResolver.getSimpleHttpResourcePath(java.net.URI)
.
If validation fails, a RuntimeException
is thrown containing details of all
failures.
input
- stream providing XML instance documentcatalog
- SchemaCatalog file to aide local schema resolution or nullCopyright © 1996–2019 Geotools. All rights reserved.