|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IXMLElement
IXMLElement is an XML element. It provides an easy to use generic interface on top of an XML like data structure like e.g. a DOM like structure. Elements returned by StdXMLBuilder also implement this interface.
StdXMLBuilder
Field Summary | |
---|---|
static int |
NO_LINE
No line number defined. |
Method Summary | |
---|---|
void |
addChild(IXMLElement child)
Adds a child element. |
IXMLElement |
createElement(String fullName)
Creates an empty element. |
IXMLElement |
createElement(String fullName,
String namespace)
Creates an empty element. |
IXMLElement |
createElement(String fullName,
String systemID,
int lineNr)
Creates an empty element. |
IXMLElement |
createElement(String fullName,
String namespace,
String systemID,
int lineNr)
Creates an empty element. |
IXMLElement |
createPCDataElement()
Creates an element to be used for #PCDATA content. |
Enumeration |
enumerateAttributeNames()
Returns an enumeration of all attribute names. |
Enumeration |
enumerateChildren()
Returns an enumeration of all child elements. |
boolean |
equals(Object rawElement)
Returns true if the element equals another element. |
boolean |
equalsXMLElement(IXMLElement elt)
Returns true if the element equals another element. |
String |
getAttribute(String name)
Deprecated. As of NanoXML/Java 2.0.1, replaced by getAttribute(java.lang.String,java.lang.String)
Returns the value of an attribute. |
int |
getAttribute(String name,
int defaultValue)
Returns the value of an attribute. |
String |
getAttribute(String name,
String defaultValue)
Returns the value of an attribute. |
int |
getAttribute(String name,
String namespace,
int defaultValue)
Returns the value of an attribute. |
String |
getAttribute(String name,
String namespace,
String defaultValue)
Returns the value of an attribute. |
int |
getAttributeCount()
Returns the number of attributes. |
String |
getAttributeNamespace(String name)
Returns the namespace of an attribute. |
Properties |
getAttributes()
Returns all attributes as a Properties object. |
Properties |
getAttributesInNamespace(String namespace)
Returns all attributes in a specific namespace as a Properties object. |
String |
getAttributeType(String name)
Returns the type of an attribute. |
String |
getAttributeType(String name,
String namespace)
Returns the type of an attribute. |
IXMLElement |
getChildAtIndex(int index)
Returns the child at a specific index. |
Vector |
getChildren()
Returns a vector containing all the child elements. |
int |
getChildrenCount()
Returns the number of children. |
Vector |
getChildrenNamed(String name)
Returns a vector of all child elements named name. |
Vector |
getChildrenNamed(String name,
String namespace)
Returns a vector of all child elements named name. |
String |
getContent()
Return the #PCDATA content of the element. |
IXMLElement |
getFirstChildNamed(String name)
Searches a child element. |
IXMLElement |
getFirstChildNamed(String name,
String namespace)
Searches a child element. |
String |
getFullName()
Returns the full name (i.e. |
int |
getLineNr()
Returns the line number in the data where the element started. |
String |
getName()
Returns the name of the element. |
String |
getNamespace()
Returns the namespace of the element. |
IXMLElement |
getParent()
Returns the parent element. |
String |
getSystemID()
Returns the system ID of the data where the element started. |
boolean |
hasAttribute(String name)
Returns whether an attribute exists. |
boolean |
hasAttribute(String name,
String namespace)
Returns whether an attribute exists. |
boolean |
hasChildren()
Returns whether the element has children. |
boolean |
isLeaf()
Returns whether the element is a leaf element. |
void |
removeAttribute(String name)
Removes an attribute. |
void |
removeAttribute(String name,
String namespace)
Removes an attribute. |
void |
removeChild(IXMLElement child)
Removes a child element. |
void |
removeChildAtIndex(int index)
Removes the child located at a certain index. |
void |
setAttribute(String name,
String value)
Sets an attribute. |
void |
setAttribute(String fullName,
String namespace,
String value)
Sets an attribute. |
void |
setContent(String content)
Sets the #PCDATA content. |
void |
setName(String name)
Sets the full name. |
void |
setName(String fullName,
String namespace)
Sets the name. |
Field Detail |
---|
static final int NO_LINE
Method Detail |
---|
IXMLElement createPCDataElement()
IXMLElement createElement(String fullName)
fullName
- the name of the element.IXMLElement createElement(String fullName, String systemID, int lineNr)
fullName
- the name of the element.systemID
- the system ID of the XML data where the element starts.lineNr
- the line in the XML data where the element starts.IXMLElement createElement(String fullName, String namespace)
fullName
- the full name of the elementnamespace
- the namespace URI.IXMLElement createElement(String fullName, String namespace, String systemID, int lineNr)
fullName
- the full name of the elementnamespace
- the namespace URI.systemID
- the system ID of the XML data where the element starts.lineNr
- the line in the XML data where the element starts.IXMLElement getParent()
String getFullName()
String getName()
String getNamespace()
void setName(String name)
name
- the non-null name.void setName(String fullName, String namespace)
fullName
- the non-null full name.namespace
- the namespace URI, which may be null.void addChild(IXMLElement child)
child
- the non-null child to add.void removeChild(IXMLElement child)
child
- the non-null child to remove.void removeChildAtIndex(int index)
index
- the index of the child, where the first child has index 0.Enumeration enumerateChildren()
boolean isLeaf()
boolean hasChildren()
int getChildrenCount()
Vector getChildren()
IXMLElement getChildAtIndex(int index) throws ArrayIndexOutOfBoundsException
index
- the index of the child
ArrayIndexOutOfBoundsException
- if the index is out of bounds.IXMLElement getFirstChildNamed(String name)
name
- the full name of the child to search for.
IXMLElement getFirstChildNamed(String name, String namespace)
name
- the name of the child to search for.namespace
- the namespace, which may be null.
Vector getChildrenNamed(String name)
name
- the full name of the children to search for.
Vector getChildrenNamed(String name, String namespace)
name
- the name of the children to search for.namespace
- the namespace, which may be null.
int getAttributeCount()
String getAttribute(String name)
getAttribute(java.lang.String,java.lang.String)
Returns the value of an attribute.
name
- the non-null name of the attribute.
String getAttribute(String name, String defaultValue)
name
- the non-null full name of the attribute.defaultValue
- the default value of the attribute.
String getAttribute(String name, String namespace, String defaultValue)
name
- the non-null name of the attribute.namespace
- the namespace URI, which may be null.defaultValue
- the default value of the attribute.
int getAttribute(String name, int defaultValue)
name
- the non-null full name of the attribute.defaultValue
- the default value of the attribute.
int getAttribute(String name, String namespace, int defaultValue)
name
- the non-null name of the attribute.namespace
- the namespace URI, which may be null.defaultValue
- the default value of the attribute.
String getAttributeType(String name)
name
- the non-null full name of the attribute.
String getAttributeNamespace(String name)
name
- the non-null full name of the attribute.
String getAttributeType(String name, String namespace)
name
- the non-null name of the attribute.namespace
- the namespace URI, which may be null.
void setAttribute(String name, String value)
name
- the non-null full name of the attribute.value
- the non-null value of the attribute.void setAttribute(String fullName, String namespace, String value)
fullName
- the non-null full name of the attribute.namespace
- the namespace URI of the attribute, which may be null.value
- the non-null value of the attribute.void removeAttribute(String name)
name
- the non-null name of the attribute.void removeAttribute(String name, String namespace)
name
- the non-null name of the attribute.namespace
- the namespace URI of the attribute, which may be null.Enumeration enumerateAttributeNames()
boolean hasAttribute(String name)
name
- the non-null name of the attribute.
boolean hasAttribute(String name, String namespace)
name
- the non-null name of the attribute.namespace
- the namespace URI of the attribute, which may be null.
Properties getAttributes()
Properties getAttributesInNamespace(String namespace)
namespace
- the namespace URI of the attributes, which may be null.
String getSystemID()
getLineNr()
int getLineNr()
NO_LINE
,
getSystemID()
String getContent()
void setContent(String content)
content
- the (possibly null) content.boolean equals(Object rawElement)
equals
in class Object
rawElement
- the element to compare toboolean equalsXMLElement(IXMLElement elt)
rawElement
- the element to compare to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |