edu.ucla.stat.SOCR.TG_distributome.editor
Class XmlValidator

java.lang.Object
  extended by edu.ucla.stat.SOCR.TG_distributome.editor.XmlValidator
All Implemented Interfaces:
org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XmlValidator
extends java.lang.Object
implements org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

Class that validates an XML encoded stream using an XSD.

Version:
11 September 2007

Constructor Summary
XmlValidator()
          Constructs an XML Validator.
 
Method Summary
 void error(org.xml.sax.SAXParseException e)
          Receives notification of a recoverable parser error.
 void fatalError(org.xml.sax.SAXParseException e)
          Receives notification of a non-recoverable parser error.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolves access to external entities.
 java.lang.String validate(java.io.InputStream xmlStream)
          Validates the encoded XML in the input stream.
 void warning(org.xml.sax.SAXParseException e)
          Receives notification of a parser warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlValidator

public XmlValidator()
Constructs an XML Validator.

Method Detail

validate

public java.lang.String validate(java.io.InputStream xmlStream)
Validates the encoded XML in the input stream.

Parameters:
xmlStream - Encoded XML.
Returns:
Invalidation messages, or the empty string if the XML file is valid.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Resolves access to external entities.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - Public identifier of the external entity being referenced, or null if none was supplied.
systemId - System identifier of the external entity being referenced.
Returns:
InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.

warning

public void warning(org.xml.sax.SAXParseException e)
Receives notification of a parser warning.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
e - Exception resulting from the warning.

error

public void error(org.xml.sax.SAXParseException e)
Receives notification of a recoverable parser error.

Specified by:
error in interface org.xml.sax.ErrorHandler
Parameters:
e - Exception resulting from the recoverable error.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
Receives notification of a non-recoverable parser error.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Parameters:
e - Exception resulting from the non-recoverable error.