|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.xml.XMLProperties
public class XMLProperties
XML properties class that gets an xml URL
and dtd file
path as input to initialize the xml org.w3c.dom.Document
which
can be accessed to get parts of the document tree. The class always throws a
DOMException
, if the Document
does not match the
query element/attribute combination. Any error during parsing will throw a
SAXParseException
. Note, so far this class only returns node
elements of type org.w3c.dom.Node#ELEMENT_NODE
.
Constructor Summary | |
---|---|
XMLProperties(URL xmlURL,
URL dtdURL)
Initializes a new xml properties object by parsing the xmlURL which internally represents a xml
Document . |
Method Summary | |
---|---|
void |
error(SAXParseException spe)
|
void |
fatalError(SAXParseException spe)
|
String |
getAttributeValue(Node elementNode,
String attName)
Returns the attribute value for a xml element and attribute name. |
String |
getAttributeValue(String elementName,
String attName,
boolean required)
Returns the attribute value for a xml element and attribute name. |
Node |
getNodeElement(String elementName,
boolean required)
Returns a Node from the document which can be associated
with the elementName argument which must be of type
Node#ELEMENT_NODE . |
void |
warning(SAXParseException spe)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLProperties(URL xmlURL, URL dtdURL) throws IOException, SAXException, ParserConfigurationException
xmlURL
which internally represents a xml
Document
.
xmlURL
- URL
where to find the XML file.dtdURL
- The DTD's URL used to parse the given xml file.
IOException
- If XML URL
not valid.
SAXException
- Parser exception caused by the
DocumentBuilder
.
ParserConfigurationException
- Parser configuration exception.
IllegalArgumentException
- If xml URL
is
null
.Method Detail |
---|
public void warning(SAXParseException spe) throws SAXException
warning
in interface ErrorHandler
SAXException
public void error(SAXParseException spe) throws SAXException
error
in interface ErrorHandler
SAXException
public void fatalError(SAXParseException spe) throws SAXException
fatalError
in interface ErrorHandler
SAXException
public final Node getNodeElement(String elementName, boolean required)
Node
from the document which can be associated
with the elementName
argument which must be of type
Node#ELEMENT_NODE
.
elementName
- xml element name to search for.required
- true
if node element is required in xml
file, otherwise false
.
DOMException
- If element is not in xml file but is required to be.
IllegalArgumentException
- If element name is null
.public final String getAttributeValue(String elementName, String attName, boolean required)
elementName
- element name to look for specified attribute.attName
- xml attribute name to search for.required
- true
if element must be specified in xml
file, otherwise false
.
null
.
DOMException
- if element is not in xml file but is required to be.
IllegalArgumentException
- if one of the arguments is
null
.public final String getAttributeValue(Node elementNode, String attName)
elementNode
- The element node to look for specified attribute.attName
- The xml attribute name to search for.
null
.
IllegalArgumentException
- If one of the arguments is
null
.
DOMException
- If element with attribute name is not in xml file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |