dk.brics.xmlgraph.validator
Class Validator

java.lang.Object
  extended by dk.brics.xmlgraph.validator.Validator

public class Validator
extends Object

Validator for XML graphs.


Field Summary
static long time
          Total number of millisecs used in this class.
 
Constructor Summary
Validator(ValidationErrorHandler e)
          Constructs a new validator.
 
Method Summary
 void validate(XMLGraph xg, Grammar g)
          Validates an XML graph relative to a Restricted RELAX NG schema.
 void validate(XMLGraph xg1, XMLGraph xg2, int xg2_root)
          Validates an XML graph relative to another XML graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

public static long time
Total number of millisecs used in this class.

Constructor Detail

Validator

public Validator(ValidationErrorHandler e)
Constructs a new validator.

Parameters:
e - error handler
Method Detail

validate

public void validate(XMLGraph xg,
                     Grammar g)
              throws ConverterException
Validates an XML graph relative to a Restricted RELAX NG schema. More precisely, this checks that the language of the XML graph is included in the language of the schema. Violations are reported to the error handler. It is assumed that the XML graph is well-defined (see XMLGraph.check(PrintStream)) and that the grammar is restricted (see Grammar.check(PrintStream)). Note that this method works by first converting the schema into an XML graph - if the schema is used for multiple validations, the schema should be pre-converted and the method validate(XMLGraph,XMLGraph,int) should be used instead for better performance.

Parameters:
xg - XML graph
g - schema
Throws:
ConverterException - may be thrown if the schema is not restricted (see Grammar.check(PrintStream))

validate

public void validate(XMLGraph xg1,
                     XMLGraph xg2,
                     int xg2_root)
Validates an XML graph relative to another XML graph. More precisely, this checks that the language of the first XML graph is included in the language of the second XML graph. It is assumed that the first XML graph is well-defined (see XMLGraph.check(PrintStream)) and that the second XML graph has been constructed by RestrRelaxNG2XMLGraph. Violations are reported to the error handler.

Parameters:
xg1 - first XML graph, assumed to be non-unknown (i.e. isUnknown returns false)
xg2 - second XML graph
xg2_root - if -1, then use the roots of xg2, otherwise use this node as override


Copyright © 2005-2010 Anders Møller.