org.spaceroots.rkcheck
Class XMLFile
- java.lang.Object
-
- org.spaceroots.rkcheck.XMLFile
-
- All Implemented Interfaces:
- org.xml.sax.ErrorHandler
- Direct Known Subclasses:
- RungeKuttaFile
public abstract class XMLFile extends java.lang.Object implements org.xml.sax.ErrorHandlerThis class is the base class for application-specific XML files reading/writing.In order to read/write application-specific XML files, a concrete class extending this abstract base class must be created and the four
analyze,build,getPublicIdandgetSystemIdmethods must be implemented.
-
-
Constructor Summary
Constructors Constructor and Description XMLFile()Simple constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract voidanalyze(org.w3c.dom.Document document, java.lang.String uri)Analyze the DOM tree.abstract voidbuild(org.w3c.dom.Document document, java.lang.String uri)Build the DOM tree.voiderror(org.xml.sax.SAXParseException exception)Receive notification of a recoverable error.voidfatalError(org.xml.sax.SAXParseException exception)Receive notification of a non-recoverable error.voidread(java.lang.String uri)Parse an XML document containing an application-specific configuration.voidwarning(org.xml.sax.SAXParseException exception)Receive notification of a warning.voidwrite(java.io.Writer writer, java.lang.String uri)Write an XML document.
-
-
-
Constructor Detail
-
XMLFile
public XMLFile() throws RKCheckExceptionSimple constructor.- Throws:
RKCheckException- if no parser can be built
-
-
Method Detail
-
read
public void read(java.lang.String uri) throws RKCheckException, java.io.IOException, java.io.FileNotFoundExceptionParse an XML document containing an application-specific configuration.- Parameters:
uri- URI of the project document to read- Throws:
RKCheckException- if an error occurs during parsing (mainly because there is an error in the document)java.io.IOException- if there is low level read errorjava.io.FileNotFoundException- if there is low level file error
-
write
public void write(java.io.Writer writer, java.lang.String uri) throws RKCheckException, java.io.IOExceptionWrite an XML document.- Parameters:
writer- writer to use for producing the documenturi- URI of the document- Throws:
RKCheckException- if an error occurs during writejava.io.IOException- if there is low level read error
-
error
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXParseExceptionReceive notification of a recoverable error.- Specified by:
errorin interfaceorg.xml.sax.ErrorHandler- Parameters:
exception- the recoverable error- Throws:
org.xml.sax.SAXException- the error is directly thrown as an exceptionorg.xml.sax.SAXParseException
-
fatalError
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXParseExceptionReceive notification of a non-recoverable error.- Specified by:
fatalErrorin interfaceorg.xml.sax.ErrorHandler- Parameters:
exception- the non-recoverable error- Throws:
org.xml.sax.SAXException- the error is directly thrown as an exceptionorg.xml.sax.SAXParseException
-
warning
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXParseExceptionReceive notification of a warning.- Specified by:
warningin interfaceorg.xml.sax.ErrorHandler- Parameters:
exception- the warning- Throws:
org.xml.sax.SAXException- the error is directly thrown as an exceptionorg.xml.sax.SAXParseException
-
analyze
public abstract void analyze(org.w3c.dom.Document document, java.lang.String uri) throws RKCheckException, java.lang.NumberFormatExceptionAnalyze the DOM tree.This method is called by the
readmethod after having build the DOM tree. Its purpose is to analyze the tree and store the contained information in application-specific ways.- Parameters:
document- DOM tree to analyzeuri- URI from which the project document was read (useful mainly for error messages)- Throws:
RKCheckException- if some data cannot be found in the treejava.lang.NumberFormatException- if some number cannot be parsed
-
build
public abstract void build(org.w3c.dom.Document document, java.lang.String uri) throws RKCheckExceptionBuild the DOM tree.This method is called by the
writemethod before writing the DOM tree. Its purpose is to build the DOM tree in application-specific ways.- Parameters:
document- empty DOM tree to builduri- URI where the project document will be written (useful mainly for error messages)- Throws:
RKCheckException- if some problem occurs while building the tree
-
-
DataMelt 3.0 © DataMelt by jWork.ORG