com.pnp.xfeature.data
Class SchemaValidator

java.lang.Object
  extended by com.pnp.xfeature.data.SchemaValidator

public class SchemaValidator
extends java.lang.Object

Validates a JDOM or DOM tree against a XML schema using the Xerces library.

Author:
Valerio Buerker

Field Summary
static java.lang.String NO_VALIDATION_ERROR
           
 
Constructor Summary
SchemaValidator()
           
 
Method Summary
static void runValidation(java.io.StringReader reader)
          Does the validation, by using the Xerces parser and building a new document.
static java.lang.String validate(org.jdom.Document jdomDocument, java.lang.String schema)
          Validates a JDOM Document against an XML Schema.
static java.lang.String validate(org.w3c.dom.Document document, java.lang.String schema)
          Validates a DOM Document against an XML Schema.
static java.lang.String validate(org.jdom.Document jdomDocument, java.lang.String schema, java.lang.String namespace)
          Validates a JDOM Document against an XML Schema.
static java.lang.String validate(org.w3c.dom.Document document, java.lang.String schema, java.lang.String namespace)
          Validates a DOM Document against an XML Schema.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_VALIDATION_ERROR

public static java.lang.String NO_VALIDATION_ERROR
Constructor Detail

SchemaValidator

public SchemaValidator()
Method Detail

validate

public static java.lang.String validate(org.jdom.Document jdomDocument,
                                        java.lang.String schema,
                                        java.lang.String namespace)
Validates a JDOM Document against an XML Schema. If there is not any error, an empty String is returned, otherwise the error message.

Parameters:
jdomDocument - JDOM document
schema - absolute path of the XML Schema
namespace - target namespace
Returns:
String containing the error message

validate

public static java.lang.String validate(org.jdom.Document jdomDocument,
                                        java.lang.String schema)
Validates a JDOM Document against an XML Schema. If there is not any error, an empty String is returned, otherwise the error message.

Parameters:
jdomDocument - JDOM document
schema - absolute path of the XML Schema
Returns:
String containing the error message

validate

public static java.lang.String validate(org.w3c.dom.Document document,
                                        java.lang.String schema,
                                        java.lang.String namespace)
Validates a DOM Document against an XML Schema. If there is not any error, an empty String is returned, otherwise the error message.

Parameters:
org.w3c.dom.Document - document
schema - absolute path of the XML Schema
namespace - target namespace
Returns:
String containing the error message

validate

public static java.lang.String validate(org.w3c.dom.Document document,
                                        java.lang.String schema)
Validates a DOM Document against an XML Schema. If there is not any error, an empty String is returned, otherwise the error message.

Parameters:
org.w3c.dom.Document - document
schema - absolute path of the XML Schema
Returns:
String containing the error message

runValidation

public static void runValidation(java.io.StringReader reader)
Does the validation, by using the Xerces parser and building a new document. The input is provided through a Reader.

Parameters:
reader - parser input


Copyright © 2004 - 2008 ETH Zurich and P&P Software GmbH, All Rights Reserved.