Esri Geoportal Server
1.0

com.esri.gpt.catalog.schema
Class XsdValidator

java.lang.Object
  extended by com.esri.gpt.catalog.schema.XsdValidator
All Implemented Interfaces:
ErrorHandler

public class XsdValidator
extends Object
implements ErrorHandler

Validates a document against an XML Schema Definition file.


Constructor Summary
XsdValidator()
          Default constructor.
 
Method Summary
static void cacheXsdReference(Schema schema)
          Caches a reference to an XSD for a schema.
 void error(SAXParseException e)
          Triggered when a SAX error occurs during XSD validation.
 void fatalError(SAXParseException e)
          Triggered when a SAX fatal error occurs during XSD validation.
protected  ValidationErrors getValidationErrors()
          Gets the validation errors.
protected  void setValidationErrors(ValidationErrors errors)
          Sets the validation errors.
 void validate(Schema schema, Source source)
          Validates a document source against the XML Schema Definition file associated with a schema.
 void validate(Schema schema, String xml)
          Validates an XML string against the XML Schema Definition file associated with a schema.
 void warning(SAXParseException e)
          Triggered when a SAX warning occurs during XSD validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XsdValidator

public XsdValidator()
Default constructor.

Method Detail

getValidationErrors

protected ValidationErrors getValidationErrors()
Gets the validation errors.

Returns:
the validation errors

setValidationErrors

protected void setValidationErrors(ValidationErrors errors)
Sets the validation errors.

Parameters:
errors - validation errors

cacheXsdReference

public static void cacheXsdReference(Schema schema)
Caches a reference to an XSD for a schema.

Parameters:
schema - the subject schema

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Triggered when a SAX fatal error occurs during XSD validation.
The error is captured and an exception is thrown.

Specified by:
fatalError in interface ErrorHandler
Parameters:
e - the associated SAX exception
Throws:
SAXException - the supplied SAXParseException is thrown to end the process

error

public void error(SAXParseException e)
           throws SAXException
Triggered when a SAX error occurs during XSD validation.
The error is captured bu no exception is thrown.

Specified by:
error in interface ErrorHandler
Parameters:
e - the associated SAX exception
Throws:
SAXException - part of the implemented method signature but never thrown

validate

public void validate(Schema schema,
                     Source source)
              throws ValidationException
Validates a document source against the XML Schema Definition file associated with a schema.

Parameters:
schema - the schema being validated
source - the source for the document being validated
Throws:
ValidationException - if validation errors were located

validate

public void validate(Schema schema,
                     String xml)
              throws ValidationException
Validates an XML string against the XML Schema Definition file associated with a schema.

Parameters:
schema - the schema being validated
xml - the XML string to be validated
Throws:
ValidationException - if validation errors were located

warning

public void warning(SAXParseException e)
             throws SAXException
Triggered when a SAX warning occurs during XSD validation.
Warnings are ignored.

Specified by:
warning in interface ErrorHandler
Parameters:
e - the associated SAX exception
Throws:
SAXException - part of the implemented method signature but never thrown

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.