org.openpermis.policy.io.xmlchecking
Class W3CXMLSchemaValidator

java.lang.Object
  extended by org.openpermis.policy.io.xmlchecking.W3CXMLSchemaValidator

public class W3CXMLSchemaValidator
extends Object

Class that abstracts the W3C XML Schema validation process. It is an implementation of the SchemaValidatorInterface.

Author:
Dimitry Bragin

Constructor Summary
W3CXMLSchemaValidator()
          Create a Validator instance with the default Schema as specified in schema_checking.properties file.
W3CXMLSchemaValidator(File schemaFile)
          Create a Validator instance with the Schema represented by the given File object.
 
Method Summary
static String validate(File file)
          Checks the file if it matches the XML scheme.
 void validate(Node r)
          Checks if xml represented by a node is valid according to the current schema.
 void validate(Reader r)
          Checks if xml content represented by a Reader is valid according to the current schema.
 void validate(Source source)
          Check if xml represented by a Source is valid according to the current schema.
 void validate(String s)
          Checks if a given xml string is valid according to the current schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

W3CXMLSchemaValidator

public W3CXMLSchemaValidator()
                      throws SAXException,
                             IOException
Create a Validator instance with the default Schema as specified in schema_checking.properties file.

Throws:
SAXException - Thrown if parsing of the Schema file fails
IOException - Thrown is a file operation fails

W3CXMLSchemaValidator

public W3CXMLSchemaValidator(File schemaFile)
                      throws SAXException,
                             IOException
Create a Validator instance with the Schema represented by the given File object.

Parameters:
schemaFile - File that contains the Schema to be used
Throws:
SAXException - Thrown if parsing of the Schema file fails
IOException - Thrown is a file operation fails
Method Detail

validate

public static String validate(File file)
Checks the file if it matches the XML scheme.

Parameters:
file - File to check
Returns:
null if of, errorstring else
Since:
0.3.0

validate

public void validate(String s)
              throws SAXException,
                     IOException
Checks if a given xml string is valid according to the current schema.

Parameters:
s - String to be validated
Throws:
SAXException - If parsing of the schema instance fails
IOException - Thrown on IO error

validate

public void validate(Reader r)
              throws SAXException,
                     IOException
Checks if xml content represented by a Reader is valid according to the current schema.

Parameters:
r - Reader accessing the xml content
Throws:
SAXException - If parsing of the schema instance fails
IOException - Thrown on IO error

validate

public void validate(Node r)
              throws SAXException,
                     IOException
Checks if xml represented by a node is valid according to the current schema.

Parameters:
r - XML Node that is to be validated
Throws:
SAXException - If parsing of the schema instance fails
IOException - Thrown on IO error

validate

public void validate(Source source)
              throws SAXException,
                     IOException
Check if xml represented by a Source is valid according to the current schema.

Parameters:
source - Source to be validated
Throws:
SAXException - If parsing of the schema instance fails
IOException - Thrown on IO error


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:10
Copyright (c) 2002-2007 Ergon Informatik AG