jpl.pds.parser
Class SAXValidation

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by jpl.pds.parser.SAXValidation
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class SAXValidation
extends org.xml.sax.helpers.DefaultHandler

Use SAX parser and schema file to validate the XML version of the product file. The handlers are overridden to capture the error messages.

Author:
J. Crichton

Constructor Summary
SAXValidation(RunLog runLog)
          Create Sax Validation object.
 
Method Summary
 void error(SAXParseException ex)
          Overrides error and print error message.
 void fatalError(SAXParseException ex)
          Overrides fatalError and prints fatal error message.
 boolean validateFile(Document document, String xsdFilename)
          Validates the product XML file using the DS schema.
 void warning(SAXParseException ex)
          Overrides warnings and print warning message.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXValidation

public SAXValidation(RunLog runLog)
Create Sax Validation object.

Parameters:
runLog - XML output stream.
Method Detail

validateFile

public final boolean validateFile(Document document,
                                  String xsdFilename)
Validates the product XML file using the DS schema.

Parameters:
document - Product in DOM format.
xsdFilename - Data Set XSD schema filename.
runLog - RunLog object used for writing messages to cmd window and output log.
Returns:
True if XML validates.

warning

public final void warning(SAXParseException ex)
Overrides warnings and print warning message.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - Exception information.

error

public final void error(SAXParseException ex)
Overrides error and print error message.

Specified by:
error in interface ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - Exception information.

fatalError

public final void fatalError(SAXParseException ex)
Overrides fatalError and prints fatal error message.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - Exception information.


Copyright © 2005-2012 Planetary Data System. All Rights Reserved.