FileDocCategorySizeDatePackage
TextNode.javaAPI DocExample4757Sat Sep 01 16:11:58 BST 2001javaxml2

TextNode

public class TextNode extends Object implements JDOMNode
A JDOMNode Strategy for String content.

This will have to be updated when the String content is replaced with a real org.jdom.Text node.

At this time, {@link #getParentNode()} fails unless you call {@link #setParentNode()} separately after constructing the instance.

Fields Summary
protected String
decorated
The decorated String
private org.jdom.Element
parent
The manually set parent of this string content
Constructors Summary
public TextNode(String string)

Constructor for the decorated attribute.

param
string String to decorate

	
                    
       
        decorated = string;
    
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.

        return "";
    
public JDOMNodegetParentNode()

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

return
JDOMNode - this node's parent.

        if (parent == null) {
            throw new RuntimeException(
                "The parent of this String content has not been set!");
        }	
        return new ElementNode(parent);
    
public java.lang.StringgetQName()

This returns the qualified name of this Node.

return
String - this node's qualified name

        // text nodes have no name
        return "";
    
public java.util.Iteratoriterator()

This always returns an empty Iterator.

return
Iterator - always empty

        return Collections.EMPTY_LIST.iterator();
    
public javaxml2.TextNodesetParent(org.jdom.Element parent)

This is a special case function, because a String can't have a parent.

return
TextNode
param
parent org.jdom.Element

        this.parent = parent;
        return this;
    
public java.lang.StringtoString()

This is the actual textual content of the node.

return
String - node's content.

        return decorated;