org.opengis.cite.osxgeotime.util
Class ValidationUtils

java.lang.Object
  extended by org.opengis.cite.osxgeotime.util.ValidationUtils

public class ValidationUtils
extends Object

A utility class that provides convenience methods to support schema validation.


Constructor Summary
ValidationUtils()
           
 
Method Summary
static org.opengis.cite.validation.SchematronValidator buildSchematronValidator(String schemaRef, String phase)
          Constructs a SchematronValidator that will check an XML resource against the rules defined in a Schematron schema.
static URI extractSchemaReference(Source source, String baseURI)
          Extracts an XML Schema reference from a source XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationUtils

public ValidationUtils()
Method Detail

buildSchematronValidator

public static org.opengis.cite.validation.SchematronValidator buildSchematronValidator(String schemaRef,
                                                                                       String phase)
Constructs a SchematronValidator that will check an XML resource against the rules defined in a Schematron schema. An attempt is made to resolve the schema reference using an entity catalog; if this fails the reference is used as given.

Parameters:
schemaRef - A reference to a Schematron schema; this is expected to be a relative or absolute URI value, possibly matching the system identifier for some entry in an entity catalog.
phase - The name of the phase to invoke.
Returns:
A SchematronValidator instance, or null if the validator cannot be constructed (e.g. invalid schema reference or phase name).

extractSchemaReference

public static URI extractSchemaReference(Source source,
                                         String baseURI)
                                  throws XMLStreamException
Extracts an XML Schema reference from a source XML document. The resulting URI value refers to the schema whose target namespace matches the namespace of the document element.

Parameters:
source - The source instance to read from; its base URI (systemId) should be set. The document element is expected to include the standard xsi:schemaLocation attribute.
baseURI - An alternative base URI to use if the source does not have a system identifier set or if its system id is a file URI. This will usually be the URI used to retrieve the resource; it may be null.
Returns:
An absolute URI reference specifying the location of an XML Schema resource, or null if no reference is found.
Throws:
XMLStreamException - If an error occurs while reading the source instance.


Copyright © 2014. All Rights Reserved.