|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object toolbox.allegato.XMLProperties
public class XMLProperties
Provides access to XML configuration properties. Provides some convenience methods that provide easier access to XML elements and attributes.
Instances of this class may also make use of a pre-processor through the use
of an XMLPreProcessor implementation. The pre-processor implementation can
be specified with the following system property:
toolbox.allegato.XMLProperties.PreProcessor
The behaviour of the XML parser used by instances of this class can be altered with the following system properties:
A properties file for use with the Toolbox framework is available at share/dtd/toolbox_catalogs.properties. The share/dtd directory of the framework must be configured as part of the classpath for this to work.
Constructor Summary | |
---|---|
XMLProperties(java.io.InputStream is)
Constructs a new XMLProperties object from the given InputStream. |
|
XMLProperties(java.io.InputStream is,
boolean doProps)
Construct a new XMLProperties object from the given InputStream and convert the member Document instance to Java properties if required. |
|
XMLProperties(java.lang.String fileName)
Constructs a new XMLProperties object from the given file name. |
|
XMLProperties(java.lang.String fileName,
boolean doProps)
Construct a new XMLProperties object from the given file name and convert the member Document instance to Java properties if required. |
Method Summary | |
---|---|
java.lang.String |
getAttributeValue(org.w3c.dom.Element element,
java.lang.String name)
Returns the value of the named attribute within the given element. |
org.w3c.dom.Document |
getDocument()
Returns the member document for this XMLProperties object. |
org.w3c.dom.Element |
getElement(org.w3c.dom.Element parent,
java.lang.String name)
Returns the named child element within the given parent element. |
org.w3c.dom.Element |
getElement(java.lang.String name)
Returns the element with the given name. |
org.w3c.dom.Element |
getElement(java.lang.String parentName,
java.lang.String name)
Returns the element within the named parent element. |
org.w3c.dom.Element |
getElementByNameAttr(java.lang.String elementName,
java.lang.String nameAttrVal)
Returns the Element with the given name and "name attribute" with the given value. |
org.w3c.dom.NodeList |
getElements(org.w3c.dom.Element parent,
java.lang.String name)
Returns all the child nodes with the given name within the given parent element. |
java.util.Properties |
getProperties()
Return the member properties for this XMLProperties object. |
java.lang.String |
getTextNodeValue(org.w3c.dom.Element parent,
java.lang.String name)
Returns the value of the named text node within the given parent element. |
java.lang.String |
getTextNodeValue(org.w3c.dom.Node textNode)
Returns the value of the given text node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLProperties(java.io.InputStream is) throws ConfException
is
- InputStream containing XML data.
ConfException
- if the InputStream cannot be parsed.public XMLProperties(java.lang.String fileName) throws ConfException, java.io.IOException
fileName
- Name of file containing XML data.
ConfException
- if an exception occurs while parsing the XML
document.
java.io.IOException
- if the file does not exist.public XMLProperties(java.io.InputStream is, boolean doProps) throws ConfException
is
- InputStream containing XML data.doProps
- If true convert the Document instance into Java
properties.
ConfException
- if the InputStream cannot be parsed.public XMLProperties(java.lang.String fileName, boolean doProps) throws ConfException, java.io.IOException
fileName
- Name of the file containing XML data.doProps
- If true convert the Document instance into Java
properties.
ConfException
- if the file cannat be parsed.
java.io.IOException
- if the file does not exist.Method Detail |
---|
public org.w3c.dom.Element getElement(java.lang.String name) throws ConfException
name
- Name of the XML element that must be returned.
ConfException
- if the element cannot be foundpublic org.w3c.dom.Element getElementByNameAttr(java.lang.String elementName, java.lang.String nameAttrVal) throws ConfException
elementName
- Name of the element to return.nameAttrVal
- Value of the name attribute.
ConfException
- if the element could not be found.public org.w3c.dom.Element getElement(java.lang.String parentName, java.lang.String name) throws ConfException
parentName
- Name of the parent element.name
- Name of the element that must be returned.
ConfException
- if the named elements does not exist.public org.w3c.dom.Element getElement(org.w3c.dom.Element parent, java.lang.String name) throws ConfException
parent
- Parent element.name
- Name of child element.
ConfException
- if the parent does not contain the named child
element.public org.w3c.dom.NodeList getElements(org.w3c.dom.Element parent, java.lang.String name) throws ConfException
parent
- Parent element containing the named children.name
- Name of the child nodes to return. If null, returns all
child nodes.
ConfException
- if the parent does not contain any children with the
given name.public java.lang.String getTextNodeValue(org.w3c.dom.Node textNode)
textNode
- The given text node.
public java.lang.String getTextNodeValue(org.w3c.dom.Element parent, java.lang.String name) throws ConfException
parent
- Parent element.name
- Name of the text node.
ConfException
- if the named node does not existpublic java.lang.String getAttributeValue(org.w3c.dom.Element element, java.lang.String name) throws ConfException
element
- Given element.name
- Attribute name.
ConfException
- if the attribute does not exist.public java.util.Properties getProperties()
public org.w3c.dom.Document getDocument()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |