|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.xml.util.XElement
Constructor Summary | |
XElement()
|
|
XElement(String name)
|
|
XElement(String name,
String value)
|
Method Summary | |
void |
addAttribute(String attname,
String attval)
Add an attribute to this XML element |
boolean |
addElement(String elname,
String val)
Add an element to the XML tree according to a "path/name" string. |
boolean |
addElement(String path,
XElement e,
boolean reuse)
Add an element to the XML tree according to a path. |
XElement |
addElement(XElement e)
Add an element as a child of this node. |
String |
getAttribute(String attname)
Retrieve one of this element's attributes |
XElement |
getElement(String localname)
Lookup an element in this node's children. |
int |
getIndex()
|
String |
getLocalName()
|
String |
getName()
|
String |
getNamespace()
|
int |
getNodeCount()
|
XVector |
getNodes()
|
String |
getValue()
|
boolean |
isLeaf()
|
static void |
main(String[] args)
Test program |
String |
normalize(String path)
|
void |
setValue(String value)
|
void |
toggleHeader(boolean h)
|
XHashtable |
toHashtable()
|
XHashtable |
toHashtable(boolean local)
|
String |
toString()
|
protected String |
toString(int indent)
Utilitary function (like toString(), but indented) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XElement()
public XElement(String name)
public XElement(String name, String value)
Method Detail |
public void toggleHeader(boolean h)
public String getName()
public String getLocalName()
public String getNamespace()
public void setValue(String value)
public String getValue()
public boolean isLeaf()
public int getIndex()
public void addAttribute(String attname, String attval)
public String getAttribute(String attname)
public XElement addElement(XElement e)
public XElement getElement(String localname)
localname
- the element name to lookup (possibly postfixed with
an index). If no index is provided, the 1st child with this element name
is returned (equivalent to localname[1]).public int getNodeCount()
public XVector getNodes()
public boolean addElement(String path, XElement e, boolean reuse)
path
- A path in the XML tree (with an XPath-like syntax).e
- The element to add in the XML treereuse
- Reuse existing elements or duplicate them.
If reuse is true, two calls to addElement() with path=/library/book
and an "author" element will produce:
/library[1]/book[1]/author[1] /library[1]/book[1]/author[2] (1 library containing 1 book with 2 authors).If reuse is false, the same call will produce:
/library[1]/book[1]/author[1] /library[2]/book[1]/author[1] (2 libraries, each one containing 1 book with 1 author).Note that reuse=false can be combined with indexes in the path; the same example with path=/library[1]/book would produce:
/library[1]/book[1]/author[1] /library[1]/book[2]/author[1] (2 books, each one with 1 author, in the same library).
public boolean addElement(String elname, String val)
elname
- The element name, composed of a path in the XML tree
(with an XPath-like syntax) + "/" + an element name.val
- The element value to add in the XML tree (in String format)public String normalize(String path)
public String toString()
toString
in class Object
protected String toString(int indent)
public XHashtable toHashtable()
public XHashtable toHashtable(boolean local)
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |