net.sf.zekr.engine.xml
Class XmlReader
java.lang.Object
net.sf.zekr.engine.xml.XmlReader
public class XmlReader
- extends java.lang.Object
- Since:
- Zekr 1.0
- Author:
- Mohsen Saboorian
Constructor Summary |
XmlReader(java.io.File file)
Reads the given XML file. |
XmlReader(java.io.InputStream xmlStream)
Reads the given XML file. |
XmlReader(java.lang.String filePath)
Reads the given XML file (with absolute or relative path of filePath). |
Method Summary |
org.w3c.dom.Document |
getDocument()
|
org.w3c.dom.Element |
getDocumentElement()
|
org.w3c.dom.Element |
getElement(java.lang.String elementHierarchy)
|
org.w3c.dom.Node |
getNode(java.lang.String nodeHierarchy)
|
org.w3c.dom.Node |
getNodeByAttr(java.lang.String nodeHierarchy,
java.lang.String attrName,
java.lang.String attrValue)
|
NodeList |
getNodes(java.lang.String nodeHierarchy)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlReader
public XmlReader(java.lang.String filePath)
throws XmlReadException
- Reads the given XML file (with absolute or relative path of filePath).
- Parameters:
filePath
- the path of the file to be read
- Throws:
XmlReadException
- if any error encountered during XML loading/parsig.
XmlReader
public XmlReader(java.io.File file)
throws XmlReadException
- Reads the given XML file.
- Parameters:
file
- the file to be read
- Throws:
XmlReadException
- if any error encountered during XML loading/parsing.
XmlReader
public XmlReader(java.io.InputStream xmlStream)
throws XmlReadException
- Reads the given XML file.
- Parameters:
file
- the file to be read
- Throws:
XmlReadException
- if any error encountered during XML loading/parsing.
getDocumentElement
public org.w3c.dom.Element getDocumentElement()
getNodes
public NodeList getNodes(java.lang.String nodeHierarchy)
- Parameters:
nodeHierarchy
- A dot separated node hierarchy for specifying a node inside other nodes. For
example "body.div"
means div
which is inside body
.
nodeHierarchy
should not contain the parent node (parentNode
),
and the hierarchy is started from parent children.
- Returns:
- the node with
nodeHierarchy
hierarchy, or null
if it can not be
found.
getNode
public org.w3c.dom.Node getNode(java.lang.String nodeHierarchy)
getElement
public org.w3c.dom.Element getElement(java.lang.String elementHierarchy)
getNodeByAttr
public org.w3c.dom.Node getNodeByAttr(java.lang.String nodeHierarchy,
java.lang.String attrName,
java.lang.String attrValue)
getDocument
public org.w3c.dom.Document getDocument()