FileDocCategorySizeDatePackage
ElementNode.javaAPI DocExample4935Sat Sep 01 16:04:26 BST 2001javaxml2

ElementNode

public class ElementNode extends Object implements JDOMNode
Node Decorator for an Element.

Implementing each basic type of JDOM nodes are Strategies for those types, this one for org.jdom.Element. Each class implementing JDOMNode will implement the node in an appropriate way for the type of class it decorates

.

Fields Summary
protected org.jdom.Element
decorated
the decorated Element
Constructors Summary
public ElementNode(org.jdom.Element element)

Constructor for the decorated element.

param
element Element to decorate

        this.decorated = element;
    
Methods Summary
public java.lang.ObjectgetNode()

This returns the decorated attribute.

return
Object - the decorated object.

        return decorated;
    
public java.lang.StringgetNodeName()

This returns the name of the node.

return
String - name of the node.

        if (decorated != null) {
            return decorated.getName();
        }
        return "";
    
public JDOMNodegetParentNode()

This returns the parent of the node, as a {@link JDOMNode}.

return
JDOMNode - this node's parent.

        if (decorated.getParent() != null) {
            return new ElementNode(decorated.getParent());
        }
        return null;
    
public java.lang.StringgetQName()

This returns the qualified name of this Node.

return
String - this node's qualified name

        if (decorated.getNamespacePrefix().equals("")) { 
            return decorated.getName();
        } else {
            return new StringBuffer(decorated.getNamespacePrefix())
                           .append(":")
                           .append(decorated.getName()).toString();
        }
    
public java.util.Iteratoriterator()

This returns an Iterator over this element's content.

return
java.util.Iterator

        List list = decorated.getAttributes();
        ArrayList content = new ArrayList(list);

        // put the element's content in the list in order
        Iterator i = decorated.getMixedContent().iterator();
        while (i.hasNext()) {
            content.add(i.next());
        }
        return content.iterator();
    
public java.lang.StringtoString()

This is the base attribute's {@link Attribute#toString()} call.

return
String - description of attribute.

        return decorated.toString();