org.netbeans.modules.xml.xam/1 1.18.0 1

org.netbeans.modules.xml.xam.spi
Class XsdBasedValidator

java.lang.Object
  extended by org.netbeans.modules.xml.xam.spi.XsdBasedValidator
All Implemented Interfaces:
Validator

public abstract class XsdBasedValidator
extends Object
implements Validator

Base class for Schema validator. Each domain specific schema validator can extend this.


Nested Class Summary
protected  class XsdBasedValidator.Handler
          Handler to receive parse events.
 
Nested classes/interfaces inherited from interface org.netbeans.modules.xml.xam.spi.Validator
Validator.ResultItem, Validator.ResultType
 
Constructor Summary
XsdBasedValidator()
          Creates a new instance of XsdBasedValidation
 
Method Summary
protected  Schema getCompiledSchema(InputStream[] schemas, LSResourceResolver lsResourceResolver)
          Subclasses can use this to get a compiled schema object.
protected  Schema getCompiledSchema(Source[] schemas, LSResourceResolver lsResourceResolver, ErrorHandler errorHandler)
           
protected abstract  Schema getSchema(Model model)
          Get Schemas that the model has to be validated against.
protected  Source getSource(Model model, XsdBasedValidator.Handler handler)
           
 DocumentModel resolveResource(String systemId, Model currentModel)
           
protected  void validate(Model model, Schema schema, XsdBasedValidator.Handler handler)
          Validates the model against the schema.
 ValidationResult validate(Model model, Validation validation, Validation.ValidationType validationType)
          Entry point to validate a model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.netbeans.modules.xml.xam.spi.Validator
getName
 

Constructor Detail

XsdBasedValidator

public XsdBasedValidator()
Creates a new instance of XsdBasedValidation

Method Detail

getSchema

protected abstract Schema getSchema(Model model)
Get Schemas that the model has to be validated against. Returns compiled Schema to be used in validation of the given model; or null if this validator does not know how to validate the model.

Parameters:
model - Get Schemas that the model has to be validated against.
Returns:
Compiled Schema object.

validate

public ValidationResult validate(Model model,
                                 Validation validation,
                                 Validation.ValidationType validationType)
Entry point to validate a model.

Specified by:
validate in interface Validator
Parameters:
model - Model to validate.
validation - Reference to Validation object.
validationType - Type of validation. Complete(slow) or partial(fast).
Returns:
ValidationResults.

getSource

protected Source getSource(Model model,
                           XsdBasedValidator.Handler handler)
Parameters:
model -
handler -
Returns:
Source input source stream for the validation.

validate

protected void validate(Model model,
                        Schema schema,
                        XsdBasedValidator.Handler handler)
Validates the model against the schema. Errors are sent to the handler.

Parameters:
model - Model to be validated.
schema - Compiled schema against which the model is validated.
handler - Handler to receive validation messages.

getCompiledSchema

protected Schema getCompiledSchema(InputStream[] schemas,
                                   LSResourceResolver lsResourceResolver)
Subclasses can use this to get a compiled schema object.

Parameters:
schemas - Input stream of schemas.
lsResourceResolver - resolver can be supplied optionally. Otherwise pass null.
Returns:
Compiled Schema object.

getCompiledSchema

protected Schema getCompiledSchema(Source[] schemas,
                                   LSResourceResolver lsResourceResolver,
                                   ErrorHandler errorHandler)

resolveResource

public DocumentModel resolveResource(String systemId,
                                     Model currentModel)

org.netbeans.modules.xml.xam/1 1.18.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.