|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.izforge.izpack.adaptator.impl.XMLElementImpl
public class XMLElementImpl
Implementation of the adaptator between nanoXml and javax
| Field Summary | |
|---|---|
private java.util.Vector<IXMLElement> |
childrenVector
Vector of the children elements. |
private org.w3c.dom.Element |
element
The dom element embedded by the XMLElement |
private boolean |
hasChanged
A flag to notice any changement made to the element. |
| Fields inherited from interface com.izforge.izpack.adaptator.IXMLElement |
|---|
NO_LINE |
| Constructor Summary | |
|---|---|
XMLElementImpl(org.w3c.dom.Node node)
Constructor saving the passed node |
|
XMLElementImpl(java.lang.String name)
Create a new root element in a new document. |
|
XMLElementImpl(java.lang.String name,
org.w3c.dom.Document inDocument)
Constructor which create a root element in the given document |
|
XMLElementImpl(java.lang.String name,
IXMLElement elementReference)
Create a element in the same document of the given element |
|
| Method Summary | |
|---|---|
void |
addChild(IXMLElement child)
Adds a child element. |
java.util.Enumeration |
enumerateAttributeNames()
Returns an enumeration of all attribute names. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of an attribute. |
java.lang.String |
getAttribute(java.lang.String name,
java.lang.String defaultValue)
Returns the value of an attribute. |
java.util.Properties |
getAttributes()
Returns all attributes as a Properties object. |
IXMLElement |
getChildAtIndex(int index)
Returns the child at a specific index. |
java.util.Vector<IXMLElement> |
getChildren()
Returns a vector containing all the child elements. |
int |
getChildrenCount()
Returns the number of children. |
java.util.Vector<IXMLElement> |
getChildrenNamed(java.lang.String name)
Returns a vector of all child elements named name. |
java.lang.String |
getContent()
Return the #PCDATA content of the element. |
org.w3c.dom.Node |
getElement()
Get the embeded node of the XmlElement |
IXMLElement |
getFirstChildNamed(java.lang.String name)
Searches a child element. |
int |
getLineNr()
Returns the line number in the data where the element started. |
java.lang.String |
getName()
Returns the name of the element. |
boolean |
hasAttribute(java.lang.String name)
Returns whether an attribute exists. |
boolean |
hasChildren()
Returns whether the element has children. |
private void |
initChildrenVector()
|
void |
removeAttribute(java.lang.String name)
Removes an attribute. |
void |
removeChild(IXMLElement child)
Removes a child element. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets an attribute. |
void |
setContent(java.lang.String content)
Sets the #PCDATA content. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private org.w3c.dom.Element element
private boolean hasChanged
private java.util.Vector<IXMLElement> childrenVector
| Constructor Detail |
|---|
public XMLElementImpl(java.lang.String name)
name - Name of the root element
public XMLElementImpl(java.lang.String name,
org.w3c.dom.Document inDocument)
name - Name of the root elementinDocument - The document in which to create the xml
public XMLElementImpl(java.lang.String name,
IXMLElement elementReference)
name - Name of the elementelementReference - Reference of an existing xml. It is used to generate an xmlElement on the same document.public XMLElementImpl(org.w3c.dom.Node node)
node - Node to save inside the XMLElement| Method Detail |
|---|
public java.lang.String getName()
IXMLElement
getName in interface IXMLElementpublic void addChild(IXMLElement child)
IXMLElement
addChild in interface IXMLElementchild - the non-null child to add.public void removeChild(IXMLElement child)
IXMLElement
removeChild in interface IXMLElementchild - the non-null child to remove.public boolean hasChildren()
IXMLElement
hasChildren in interface IXMLElementprivate void initChildrenVector()
public int getChildrenCount()
IXMLElement
getChildrenCount in interface IXMLElementpublic java.util.Vector<IXMLElement> getChildren()
IXMLElement
getChildren in interface IXMLElementpublic IXMLElement getChildAtIndex(int index)
IXMLElement
getChildAtIndex in interface IXMLElementindex - Index of the child
public IXMLElement getFirstChildNamed(java.lang.String name)
IXMLElement
getFirstChildNamed in interface IXMLElementname - the name of the child to search for.
public java.util.Vector<IXMLElement> getChildrenNamed(java.lang.String name)
IXMLElement
getChildrenNamed in interface IXMLElementname - the name of the children to search for.
public java.lang.String getAttribute(java.lang.String name)
IXMLElement
getAttribute in interface IXMLElementname - the non-null name of the attribute.
public java.lang.String getAttribute(java.lang.String name,
java.lang.String defaultValue)
IXMLElement
getAttribute in interface IXMLElementname - the non-null name of the attribute.defaultValue - the default value of the attribute.
public void setAttribute(java.lang.String name,
java.lang.String value)
IXMLElement
setAttribute in interface IXMLElementname - the non-null name of the attribute.value - the non-null value of the attribute.public void removeAttribute(java.lang.String name)
IXMLElement
removeAttribute in interface IXMLElementname - the non-null name of the attribute.public java.util.Enumeration enumerateAttributeNames()
IXMLElement
enumerateAttributeNames in interface IXMLElementpublic boolean hasAttribute(java.lang.String name)
IXMLElement
hasAttribute in interface IXMLElementname - The name of the attribute
public java.util.Properties getAttributes()
IXMLElement
getAttributes in interface IXMLElementpublic int getLineNr()
IXMLElement
getLineNr in interface IXMLElementIXMLElement.NO_LINEpublic java.lang.String getContent()
IXMLElement
getContent in interface IXMLElementpublic void setContent(java.lang.String content)
IXMLElement
setContent in interface IXMLElementcontent - the (possibly null) content.public org.w3c.dom.Node getElement()
IXMLElement
getElement in interface IXMLElementpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||