|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproper.xml.Node
proper.xml.Element
public class Element
This class represents an XML node.
Constructor Summary | |
---|---|
Element(Node parent,
java.lang.String name)
initializes the object with the given parent and name |
|
Element(Node parent,
java.lang.String name,
java.lang.String content)
initializes the object with the given parent, name and content |
|
Element(java.lang.String name)
initializes the object with the given name and NO parent |
|
Element(java.lang.String name,
java.lang.String content)
initializes the object with the given name and content, but NO parent |
Method Summary | |
---|---|
void |
add(javax.swing.tree.MutableTreeNode child)
adds the given child to its own |
void |
addAttribute(Attribute attr)
adds the given attribute to its own list |
java.util.Enumeration |
attributes()
returns the attributes |
java.util.Enumeration |
children()
returns the children |
boolean |
getAllowsChildren()
whether we can add children |
Attribute |
getAttribute(java.lang.String name)
returns the attribute with the given index, can be NULL |
Attribute |
getAttributeAt(int attIndex)
returns the attribute at the given index |
int |
getAttributeCount()
returns the number of attributes of this element |
javax.swing.tree.TreeNode |
getChildAt(int childIndex)
returns the child at the given index |
int |
getChildCount()
returns the number of children this element has |
java.lang.String |
getContent()
returns the content of this element, can be NULL |
int |
getIndex(javax.swing.tree.TreeNode node)
returns the index of the given node in its children, -1 if not found |
java.lang.String |
getName()
the name of this element |
void |
insert(javax.swing.tree.MutableTreeNode child,
int index)
inserts the given child at the specified index |
void |
insertAttribute(Attribute attr,
int index)
inserts the given attribute at the specified index |
boolean |
isEmpty()
checks whether we have content or not |
boolean |
isLeaf()
returns whether this element is a leaf |
static void |
main(java.lang.String[] args)
for testing only |
void |
remove(int index)
removes the element at the specified index |
void |
remove(javax.swing.tree.MutableTreeNode node)
removes the given node from the elements |
void |
removeAll()
removes all the children |
void |
removeAllAttributes()
removes all the attributes |
void |
removeAttribute(Attribute attr)
removes the given attribute from the attributes |
void |
removeAttribute(int index)
removes the attribute at the specified index |
void |
setContent(java.lang.String content)
sets the content of the element |
java.lang.String |
toString()
returns the element as a string |
Methods inherited from class proper.xml.Node |
---|
getDepth, getIndention, getParent, getRoot, isContainer, removeFromParent, setIndention, setIsContainer, setParent, setUserObject |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Element(java.lang.String name)
public Element(java.lang.String name, java.lang.String content)
public Element(Node parent, java.lang.String name)
public Element(Node parent, java.lang.String name, java.lang.String content)
Method Detail |
---|
public java.util.Enumeration attributes()
public java.util.Enumeration children()
children
in interface javax.swing.tree.TreeNode
children
in class Node
public boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
getAllowsChildren
in class Node
public javax.swing.tree.TreeNode getChildAt(int childIndex)
getChildAt
in interface javax.swing.tree.TreeNode
getChildAt
in class Node
public int getChildCount()
getChildCount
in interface javax.swing.tree.TreeNode
getChildCount
in class Node
public Attribute getAttributeAt(int attIndex)
public Attribute getAttribute(java.lang.String name)
public int getAttributeCount()
public int getIndex(javax.swing.tree.TreeNode node)
getIndex
in interface javax.swing.tree.TreeNode
getIndex
in class Node
public boolean isLeaf()
isLeaf
in interface javax.swing.tree.TreeNode
isLeaf
in class Node
public void add(javax.swing.tree.MutableTreeNode child)
public void addAttribute(Attribute attr)
public void insert(javax.swing.tree.MutableTreeNode child, int index)
insert
in interface javax.swing.tree.MutableTreeNode
insert
in class Node
public void insertAttribute(Attribute attr, int index)
public void remove(int index)
remove
in interface javax.swing.tree.MutableTreeNode
remove
in class Node
public void removeAttribute(int index)
public void remove(javax.swing.tree.MutableTreeNode node)
remove
in interface javax.swing.tree.MutableTreeNode
remove
in class Node
public void removeAttribute(Attribute attr)
public void removeAll()
public void removeAllAttributes()
public java.lang.String getName()
public void setContent(java.lang.String content)
public java.lang.String getContent()
public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |