|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ejen.util.DOMUtil
DOM utility (static methods used in java code).
Field Summary | |
static String |
S_PY_NAME
|
static String |
S_PY_PROPERTY_NODE_NAME
|
static String |
S_PY_VALUE
|
Constructor Summary | |
DOMUtil()
|
Method Summary | |
static Node |
createCDATANode(Document doc,
Node parent,
String nodeName,
String nodeValue)
Creates a new Node of name 'nodeName', in the 'doc' Document, child of the 'parent' Node, and fills it with a CDATA Node whose content is 'nodeValue'. |
static Node |
createCDATANode(Document doc,
String nodeName,
String nodeValue)
Creates a new Node of name 'nodeName', in the 'doc' Document, and fills it with a CDATA Node whose content is 'nodeValue'. |
static Node |
createNode(Document doc,
Node parent,
String nodeName)
Creates a new Node of name 'nodeName', in the 'doc' Document, child of the 'parent' Node. |
static Node |
createTextNode(Document doc,
String nodeName,
String nodeValue)
Creates a new Node of name 'nodeName', in the 'doc' Document, and fills it with a text Node whose content is 'nodeValue'. |
static String |
getAttribute(Node n,
String name)
Returns a Node attribute value. |
static Properties |
getChildProperties(Node n)
Returns a set of properties from a given parent Node .
|
static Properties |
getChildProperties(Node parent,
Properties props)
Appends to an existing set of properties those found in a given parent Node .
|
static String[] |
getProperty(Node n)
Returns a property as an array of two Strings. |
static String |
getProperty(Node n,
String name)
Returns a property value. |
static Document |
newDocument()
Create a new Document object. |
static Document |
parseXMLFile(String name)
Parse a XML document file. |
static Document |
parseXMLString(String xmlString)
Parse a XML document String (using DEFAULT_XML_DATA_ENCODING
encoding). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String S_PY_PROPERTY_NODE_NAME
public static final String S_PY_NAME
public static final String S_PY_VALUE
Constructor Detail |
public DOMUtil()
Method Detail |
public static String getAttribute(Node n, String name)
n
- the Node
from which the attribute must be retreived.name
- the name of the attribute.
null
if there is no such attribute.public static String getProperty(Node n, String name)
The n
parameter must have the following format:
<property name="..." value="..."> |
n
- the Node
from which the property must be retreived.name
- the name of the property (ie: the value of the "name" attribute).
null
if there is no such property.public static String[] getProperty(Node n)
The n
parameter must have the following format:
<property name="..." value="..."> |
n
- the Node
from which the property must be retreived.
null
if there is no such property.public static Properties getChildProperties(Node n)
Node
.
Each child property must have the following format:
<property name="..." value="..."> |
Other kind of child nodes are ignored.
n
- the Node
from which the child properties must be retreived.
public static Properties getChildProperties(Node parent, Properties props)
Node
.
Each child property must have the following format:
<property name="..." value="..."> |
Other kind of child nodes are ignored.
props
- the existing properties.
props
parameter (with appended child properties).public static Document newDocument()
Document
object.
Document
.
WrappedRuntimeException
- creation error.public static Document parseXMLFile(String name)
name
- the XML file name.
Document
object.
WrappedRuntimeException
- error (no such file, parse error).public static Document parseXMLString(String xmlString)
String
(using DEFAULT_XML_DATA_ENCODING
encoding).
xmlString
- the XML content String
. If xmlString
is null
, the DEFAULT_XML_DATA
is used.
Document
object.
WrappedRuntimeException
- error (parse error).public static Node createNode(Document doc, Node parent, String nodeName)
doc
- the owning Document of the new Node.parent
- the parent Node of the new Node.nodeName
- name of the Node
to be created.
WrappedRuntimeException
- DOM errors.public static Node createCDATANode(Document doc, Node parent, String nodeName, String nodeValue)
doc
- the owning Document of the new Node.parent
- the parent Node of the new Node.nodeName
- name of the Node
to be created.nodeValue
- value of the CDATA Node
to be created.
WrappedRuntimeException
- DOM errors.public static Node createCDATANode(Document doc, String nodeName, String nodeValue)
doc
- the owning Document of the new Node.nodeName
- name of the Node
to be created.nodeValue
- value of the CDATA Node
to be created.
WrappedRuntimeException
- DOM errors.public static Node createTextNode(Document doc, String nodeName, String nodeValue)
doc
- the owning Document of the new Node.nodeName
- name of the Node
to be created.nodeValue
- value of the text Node
to be created.
WrappedRuntimeException
- DOM errors.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |