com.izforge.izpack.adaptator
Interface IXMLElement

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
XMLElementImpl

public interface IXMLElement
extends java.io.Serializable

Interface of the adaptator between the methods of nanoXml and javax

Author:
Anthonin Bonnefoy, David Duponchel

Field Summary
static int NO_LINE
          No line number defined.
 
Method Summary
 void addChild(IXMLElement child)
          Adds a child element.
 java.util.Enumeration enumerateAttributeNames()
          Returns an enumeration of all attribute names.
 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.
 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.
 

Field Detail

NO_LINE

static final int NO_LINE
No line number defined.

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns the name of the element.

Returns:
the name, or null if the element only contains #PCDATA.

addChild

void addChild(IXMLElement child)
Adds a child element.

Parameters:
child - the non-null child to add.

removeChild

void removeChild(IXMLElement child)
Removes a child element.

Parameters:
child - the non-null child to remove.

hasChildren

boolean hasChildren()
Returns whether the element has children.

Returns:
true if the element has children.

getChildrenCount

int getChildrenCount()
Returns the number of children.

Returns:
the count.

getChildren

java.util.Vector<IXMLElement> getChildren()
Returns a vector containing all the child elements.

Returns:
the vector.

getChildAtIndex

IXMLElement getChildAtIndex(int index)
                            throws java.lang.ArrayIndexOutOfBoundsException
Returns the child at a specific index.

Parameters:
index - Index of the child
Returns:
the non-null child
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.

getFirstChildNamed

IXMLElement getFirstChildNamed(java.lang.String name)
Searches a child element.

Parameters:
name - the name of the child to search for.
Returns:
the child element, or null if no such child was found.

getChildrenNamed

java.util.Vector<IXMLElement> getChildrenNamed(java.lang.String name)
Returns a vector of all child elements named name.

Parameters:
name - the name of the children to search for.
Returns:
the non-null vector of child elements.

getAttribute

java.lang.String getAttribute(java.lang.String name)
Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
Returns:
the value, or null if the attribute does not exist.

getAttribute

java.lang.String getAttribute(java.lang.String name,
                              java.lang.String defaultValue)
Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
defaultValue - the default value of the attribute.
Returns:
the value, or defaultValue if the attribute does not exist.

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.String value)
Sets an attribute.

Parameters:
name - the non-null name of the attribute.
value - the non-null value of the attribute.

removeAttribute

void removeAttribute(java.lang.String name)
Removes an attribute.

Parameters:
name - the non-null name of the attribute.

enumerateAttributeNames

java.util.Enumeration enumerateAttributeNames()
Returns an enumeration of all attribute names.

Returns:
the non-null enumeration.

hasAttribute

boolean hasAttribute(java.lang.String name)
Returns whether an attribute exists.

Parameters:
name - The name of the attribute
Returns:
true if the attribute exists.

getAttributes

java.util.Properties getAttributes()
Returns all attributes as a Properties object.

Returns:
the non-null set.

getLineNr

int getLineNr()
Returns the line number in the data where the element started.

Returns:
the line number, or NO_LINE if unknown.
See Also:
NO_LINE

getContent

java.lang.String getContent()
Return the #PCDATA content of the element. If the element has a combination of #PCDATA content and child elements, the #PCDATA sections can be retrieved as unnamed child objects. In this case, this method returns null.

Returns:
the content.

setContent

void setContent(java.lang.String content)
Sets the #PCDATA content. It is an error to call this method with a non-null value if there are child objects.

Parameters:
content - the (possibly null) content.

getElement

org.w3c.dom.Node getElement()
Get the embeded node of the XmlElement

Returns:
Embedded node