org.mortbay.xml

Class XmlParser.Node

public static class XmlParser.Node extends AbstractList

XML Node. Represents an XML element with optional attributes and ordered content.
Method Summary
voidadd(int i, Object o)
voidclear()
Objectget(int i)
Get the ith child node or content.
XmlParser.Nodeget(String tag)
Get the first child node with the tag.
StringgetAttribute(String name)
Get an element attribute.
StringgetAttribute(String name, String dft)
Get an element attribute.
XmlParser.Attribute[]getAttributes()
Get an array of element attributes.
XmlParser.NodegetParent()
StringgetPath()
StringgetString(String tag, boolean tags, boolean trim)
Get a tag as a string.
StringgetTag()
Iteratoriterator(String tag)
Iterator over named child nodes.
intsize()
Get the number of children nodes.
StringtoString()
StringtoString(boolean tag)
Convert to a string.
StringtoString(boolean tag, boolean trim)
Convert to a string.

Method Detail

add

public void add(int i, Object o)

clear

public void clear()

get

public Object get(int i)
Get the ith child node or content.

Returns: Node or String.

get

public XmlParser.Node get(String tag)
Get the first child node with the tag.

Parameters: tag

Returns: Node or null.

getAttribute

public String getAttribute(String name)
Get an element attribute.

Returns: attribute or null.

getAttribute

public String getAttribute(String name, String dft)
Get an element attribute.

Returns: attribute or null.

getAttributes

public XmlParser.Attribute[] getAttributes()
Get an array of element attributes.

getParent

public XmlParser.Node getParent()

getPath

public String getPath()

getString

public String getString(String tag, boolean tags, boolean trim)
Get a tag as a string.

Parameters: tag The tag to get tags IF true, tags are included in the value. trim If true, trim the value.

Returns: results of get(tag).toString(tags).

getTag

public String getTag()

iterator

public Iterator iterator(String tag)
Iterator over named child nodes.

Parameters: tag The tag of the nodes.

Returns: Iterator over all child nodes with the specified tag.

size

public int size()
Get the number of children nodes.

toString

public String toString()

toString

public String toString(boolean tag)
Convert to a string.

Parameters: tag If false, only content is shown.

toString

public String toString(boolean tag, boolean trim)
Convert to a string.

Parameters: tag If false, only content is shown.

Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.