com.cysols.iodef
Class IodefXMLValidator

java.lang.Object
  extended by com.cysols.iodef.XMLFileWriter
      extended by com.cysols.iodef.IodefXMLValidator

public class IodefXMLValidator
extends XMLFileWriter

Validate XML documents by XML Schema.

Author:
cysol

Nested Class Summary
protected  class IodefXMLValidator.XMLErrorHandler
           
 
Field Summary
protected  String myTmpFile
           
 
Constructor Summary
IodefXMLValidator()
          Default constractor, initializes.
 
Method Summary
static void main(String[] args)
           
 Document validate(IODEFDocument iodef)
          Validate the specified incident element, and returns XML document included the specified Incident element.
 void validate(String xml_file)
          Validates the specified xml file, if some errors are found, throws XMLValidationError contained all error.
protected  void writeToFile(String file, Document doc)
           
 
Methods inherited from class com.cysols.iodef.XMLFileWriter
createDirs, write, write, write, writeToFile, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myTmpFile

protected String myTmpFile
Constructor Detail

IodefXMLValidator

public IodefXMLValidator()
Default constractor, initializes.

Method Detail

validate

public void validate(String xml_file)
              throws XMLValidationError,
                     XMLValidationException
Validates the specified xml file, if some errors are found, throws XMLValidationError contained all error.

Parameters:
xml_file - xml file name
Throws:
XMLValidationException - if writing goes wrong
XMLValidationError - if validation is not passed

validate

public Document validate(IODEFDocument iodef)
                  throws XMLValidationError,
                         XMLValidationException
Validate the specified incident element, and returns XML document included the specified Incident element.

Parameters:
iodef - a IODEFDocument elmenet
Returns:
XML Document included a incident element
Throws:
XMLValidationException - if writing goes wrong
XMLValidationError - if validation is not passed

writeToFile

protected void writeToFile(String file,
                           Document doc)
                    throws XMLValidationException
Throws:
XMLValidationException

main

public static void main(String[] args)