com.generationjava.io.xml
Class XMLNode

java.lang.Object
  extended bycom.generationjava.io.xml.XMLNode

public class XMLNode
extends Object

An xml tag. It can be a processing instructon, an empty tag or a normal tag. Currently, if the tag is inside a namespace then that is a part of the name. That is, all names of tags are fully qualified by the namespace.


Constructor Summary
XMLNode()
          Empty Constructor.
XMLNode(String name)
          Create a new node with this name.
 
Method Summary
 void addAttr(String name, String value)
          Add an attribute with specified name and value.
 void addNode(XMLNode node)
          Add a child node to this node.
 String bodyToString()
          Get the String version of the body of this tag.
 Enumeration enumerateAttr()
          Enumerate over all the attributes of this node.
 Enumeration enumerateNode()
          Enumerate over all of this node's children nodes.
 Enumeration enumerateNode(String name)
           
 String getAttr(String name)
          Get the attribute with the specified name.
 String getName()
          Get the name of this node.
 String getNamespace()
          Get the namespace of this node.
 XMLNode getNode(String name)
          Get the node with the specified name.
 String getTagName()
          Get the tag name of this node.
 String getValue()
          Get the appended toString's of the children of this node.
 boolean isComment()
          Is it a comment
 boolean isDocType()
          Is it a doctype
 boolean isEmpty()
          Is this node empty.
 boolean isInvisible()
          Is it invisible
 boolean isPI()
          Is it a processing instruction
 boolean isTag()
          Is this a normal tag? That is, not plaintext, not comment and not a pi.
 boolean isTextNode()
          Is this a text node.
 void setComment(boolean b)
          Set whether this node is a comment or not.
 void setDocType(boolean b)
          Set whether this node is a doctype or not.
 void setInvisible(boolean b)
          Set whether this node is invisible or not.
 void setPI(boolean b)
          Set whether this node is a processing instruction or not.
 void setPlaintext(String str)
          Set the plaintext contained in this node.
 String toString()
          Turn this node into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLNode

public XMLNode()
Empty Constructor.


XMLNode

public XMLNode(String name)
Create a new node with this name.

Method Detail

addNode

public void addNode(XMLNode node)
Add a child node to this node.


enumerateNode

public Enumeration enumerateNode(String name)

addAttr

public void addAttr(String name,
                    String value)
Add an attribute with specified name and value.


getAttr

public String getAttr(String name)
Get the attribute with the specified name.


enumerateAttr

public Enumeration enumerateAttr()
Enumerate over all the attributes of this node. In the order they were added.


getNode

public XMLNode getNode(String name)
Get the node with the specified name.


enumerateNode

public Enumeration enumerateNode()
Enumerate over all of this node's children nodes.


getName

public String getName()
Get the name of this node. Includes the namespace.


getNamespace

public String getNamespace()
Get the namespace of this node.


getTagName

public String getTagName()
Get the tag name of this node. Doesn't include namespace.


getValue

public String getValue()
Get the appended toString's of the children of this node. For a text node, it will print out the plaintext.


setPlaintext

public void setPlaintext(String str)
Set the plaintext contained in this node.


isTag

public boolean isTag()
Is this a normal tag? That is, not plaintext, not comment and not a pi.


isInvisible

public boolean isInvisible()
Is it invisible


setInvisible

public void setInvisible(boolean b)
Set whether this node is invisible or not.


isDocType

public boolean isDocType()
Is it a doctype


setDocType

public void setDocType(boolean b)
Set whether this node is a doctype or not.


isComment

public boolean isComment()
Is it a comment


setComment

public void setComment(boolean b)
Set whether this node is a comment or not.


isPI

public boolean isPI()
Is it a processing instruction


setPI

public void setPI(boolean b)
Set whether this node is a processing instruction or not.


isEmpty

public boolean isEmpty()
Is this node empty.


isTextNode

public boolean isTextNode()
Is this a text node.


toString

public String toString()
Turn this node into a String. Outputs the node as XML. So a large amount of output.


bodyToString

public String bodyToString()
Get the String version of the body of this tag.



Copyright © 2002-2005 OSJava. All Rights Reserved.