|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.spaceroots.rkcheck.XMLFile
This 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, getPublicId and getSystemId
methods must be implemented.
| Field Summary | |
protected java.lang.String |
uri
URI of the configuration file. |
| Constructor Summary | |
XMLFile()
Simple constructor. |
|
| Method Summary | |
abstract void |
analyze(org.w3c.dom.Document document,
java.lang.String uri)
Analyze the DOM tree. |
abstract void |
build(org.w3c.dom.Document document,
java.lang.String uri)
Build the DOM tree. |
void |
error(org.xml.sax.SAXParseException exception)
Receive notification of a recoverable error. |
void |
fatalError(org.xml.sax.SAXParseException exception)
Receive notification of a non-recoverable error. |
protected java.lang.String |
getAttribute(org.w3c.dom.Node element,
java.lang.String name,
boolean missingOK)
Get an attribute value. |
protected java.lang.String |
getContent(org.w3c.dom.Node node)
Get the content of a node. |
protected org.w3c.dom.Element |
getElement(org.w3c.dom.Node parent,
java.lang.String name,
boolean missingOK)
Get a specific child element node. |
protected abstract java.lang.String |
getPublicId()
Get the public ID of the DTD. |
protected abstract java.lang.String |
getSystemId()
Get the system ID of the DTD. |
void |
read(java.lang.String uri)
Parse an XML document containing an application-specific configuration. |
void |
warning(org.xml.sax.SAXParseException exception)
Receive notification of a warning. |
void |
write(java.io.Writer writer,
java.lang.String uri)
Write an XML document. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String uri
| Constructor Detail |
public XMLFile()
throws RKCheckException
RKCheckException - if no parser can be built| Method Detail |
public void read(java.lang.String uri)
throws RKCheckException,
java.io.IOException,
java.io.FileNotFoundException
uri - URI of the project document to read
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 error
java.io.FileNotFoundException - if there is low level file error
public void write(java.io.Writer writer,
java.lang.String uri)
throws RKCheckException,
java.io.IOException
writer - writer to use for producing the documenturi - URI of the document
RKCheckException - if an error occurs during write
java.io.IOException - if there is low level read error
protected org.w3c.dom.Element getElement(org.w3c.dom.Node parent,
java.lang.String name,
boolean missingOK)
throws RKCheckException
parent - parent nodename - name of the elementmissingOK - if true no exception is generated if the element
is not found
missingOK is true)
RKCheckException - if the element cannot be found and
missingOK is false
protected java.lang.String getAttribute(org.w3c.dom.Node element,
java.lang.String name,
boolean missingOK)
throws RKCheckException
element - element containing the attributename - attribute namemissingOK - if true no exception is generated if the attribute
is not found
missingOK is true)
RKCheckException - if the attribute cannot be found and
missingOK is false
protected java.lang.String getContent(org.w3c.dom.Node node)
throws RKCheckException
node - node to analyze
RKCheckException - if the node contains unexpected elements
public void error(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXParseException
error in interface org.xml.sax.ErrorHandlerexception - the recoverable error
org.xml.sax.SAXException - the error is directly thrown as an exception
org.xml.sax.SAXParseException
public void fatalError(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXParseException
fatalError in interface org.xml.sax.ErrorHandlerexception - the non-recoverable error
org.xml.sax.SAXException - the error is directly thrown as an exception
org.xml.sax.SAXParseException
public void warning(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXParseException
warning in interface org.xml.sax.ErrorHandlerexception - the warning
org.xml.sax.SAXException - the error is directly thrown as an exception
org.xml.sax.SAXParseException
public abstract void analyze(org.w3c.dom.Document document,
java.lang.String uri)
throws RKCheckException,
java.lang.NumberFormatException
This method is called by the read method after
having build the DOM tree. Its purpose is to analyze the tree and
store the contained information in application-specific ways.
document - DOM tree to analyzeuri - URI from which the project document was read (useful
mainly for error messages)
RKCheckException - if some data cannot be found in the tree
java.lang.NumberFormatException - if some number cannot be parsed
public abstract void build(org.w3c.dom.Document document,
java.lang.String uri)
throws RKCheckException
This method is called by the write method
before writing the DOM tree. Its purpose is to build the DOM tree
in application-specific ways.
document - empty DOM tree to builduri - URI where the project document will be written (useful
mainly for error messages)
RKCheckException - if some problem occurs while building
the treeprotected abstract java.lang.String getPublicId()
protected abstract java.lang.String getSystemId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||