All Packages Class Hierarchy This Package Previous Next Index
Class xg.xg_Node
java.lang.Object
|
+----com.sun.java.swing.tree.DefaultMutableTreeNode
|
+----xg.xg_Node
- public abstract class xg_Node
- extends DefaultMutableTreeNode
- implements Element
Base class for all types of XML entity.
-
EndPosition
- The position of the end of this node relative to the start of the
document it is in.
-
NodeName
- The name of this node.
-
ParentNode
- This node's parent.
-
PrecedingWhitespace
- If this node was preceded by whitespace in the source, this is it.
-
StartPosition
- The position of the start of this node relative to the start of the
document it is in.
-
xg_Node()
- Default constructor.
-
xg_Node(String)
- Construct a node with a name.
-
addChild(xg_Node)
- Add a child.
-
getAncestorOfType(String)
- Get the first ancestor of this node whose NodeName is InputTypeName (or null
if it doesn't have an ancestor of this type).
-
getAttributes()
- Get a collection of attributes this node contains.
-
getChild(int)
- Get the child element with the given index.
-
getChildrenOfType(int)
- Get all the child nodes of a particular type code.
-
getChildrenOfType(String)
- Get all the child nodes of a particular named type.
-
getDocument()
- Get the swing.text.Document associated with this node.
-
getElement(int)
- Get the child element at the given index.
-
getElementCount()
- Get the number of child elements contained by this element.
-
getElementIndex(int)
- Get the child element index closest to the given offset.
-
getEndOffset()
- Get the offset from the beginning of the document at which this element
ends.
-
getFirstChildOfType(String)
- Get the first child element of a particular named type.
-
getName()
- Get the name of this node.
-
getNodeName()
- Get the name of this node.
-
getNodeType()
- Get the type of this node, using only type values defined for the DOM.
-
getParentElement()
- Get this node's parent (as an Element).
-
getParentNode()
- Get this node's parent.
-
getPrecedingWhitespace()
- Get the value of the preceding whitespace.
-
getPrecedingWhitespaceLength()
- Get the length of the preceding whitespace.
-
getRootNode()
- Get the top-level node of the tree to which this node belongs.
-
getStartOffset()
- Get the offset from the beginning of the document at which this element
begins.
-
getSummaryString()
- Get a summary descriptive string suitable for display in the tree view or
elsewhere.
-
getType()
- Get the type of this node.
-
hasChildNodes()
- Indicate whether this node has children.
-
insertChild(xg_Node, int)
- Insert a child at a specified position.
-
reset()
- Clear out the contents of this node.
-
save(Writer)
- Save this node (and its children) as an XML source in InputWriter.
-
saveChildren(Writer)
- Save this node's children in XML source form in InputWriter.
-
setEndPosition(Position)
- Set the position of the end of this node relative to the start of the
document it is in.
-
setName(String)
- Set the name of this node.
-
setParentNode(xg_Node)
- Set the parent of this node.
-
setPrecedingWhitespace(String)
- Set the value of the preceding whitespace.
-
setStartPosition(Position)
- Set the position of the start of this node relative to the start of the
document it is in.
-
toString()
- Return a string representation of the node (intended for use as debug
output).
-
validate()
- Validate this node.
-
verify()
- Verify that this node is correct (ie.
-
writeContent(Writer)
- Write this node's content (and its children) to InputWriter.
-
writePrecedingWhitespace(Writer)
- Write this node's content (and its children) to InputWriter.
NodeName
protected String NodeName
- The name of this node.
PrecedingWhitespace
protected String PrecedingWhitespace
- If this node was preceded by whitespace in the source, this is it.
ParentNode
protected xg_Node ParentNode
- This node's parent. Note that attribute 'parent' is inherited from
DefaultMutableTreeNode, so ParentNode is not really necessary and is
probably doomed to removal in due course.
StartPosition
protected Position StartPosition
- The position of the start of this node relative to the start of the
document it is in.
EndPosition
protected Position EndPosition
- The position of the end of this node relative to the start of the
document it is in.
xg_Node
public xg_Node()
- Default constructor.
xg_Node
public xg_Node(String InputNodeName)
- Construct a node with a name.
- Parameters:
- InputNodeName - The name of the node
reset
public void reset()
- Clear out the contents of this node.
save
public void save(Writer InputWriter) throws IOException
- Save this node (and its children) as an XML source in InputWriter.
- Parameters:
- InputWriter - The writer to which the XML will be written
saveChildren
public void saveChildren(Writer InputWriter) throws IOException
- Save this node's children in XML source form in InputWriter.
- Parameters:
- InputWriter - The writer to which the XML will be written
writeContent
public void writeContent(Writer InputWriter) throws IOException
- Write this node's content (and its children) to InputWriter. This
implementation writes nothing, and derived classes which wish to write
content must override it.
- Parameters:
- InputWriter - The writer to which the content will be written
writePrecedingWhitespace
public void writePrecedingWhitespace(Writer InputWriter) throws IOException
- Write this node's content (and its children) to InputWriter. This
implementation writes nothing, and derived classes which wish to write
content must override it.
- Parameters:
- InputWriter - The writer to which the content will be written
addChild
public void addChild(xg_Node InputChildNode)
- Add a child.
- Parameters:
- InputChildEntity - The child to be added
insertChild
public void insertChild(xg_Node InputChildNode,
int InputChildPosition)
- Insert a child at a specified position.
- Parameters:
- InputChildEntity - The child to be added
- InputChildPosition - The position in the list of children at which
to add the child
verify
public void verify() throws xg_VerificationException
- Verify that this node is correct (ie. internally correct and/or consistent
with other nodes - such as its parent). This constitutes semantic checking
on this node. Verification of this sort is meaningful only in special
derived classes, since the classes for handling standard XML have no
semantic knowledge (and therefore never return an error).
This method also provides derived classes with an opportunity to perform
processing once they have been fully parsed (say, to compute the values of
derivative attribute).
- Throws: xg_VerificationException
- Error in verification
validate
public void validate() throws xg_ValidationException
- Validate this node.
- Throws: xg_ValidationException
- Error in validation
setName
public void setName(String InputNodeName)
- Set the name of this node.
- Parameters:
- NodeName - The name of this node
setParentNode
public void setParentNode(xg_Node InputParentNode)
- Set the parent of this node.
- Parameters:
- ParentNode - The parent of this node
setPrecedingWhitespace
public void setPrecedingWhitespace(String InputPrecedingWhitespace)
- Set the value of the preceding whitespace.
- Parameters:
- InputPrecedingWhitespace - Value of the preceding whitespace
setStartPosition
public void setStartPosition(Position InputStartPosition)
- Set the position of the start of this node relative to the start of the
document it is in.
- Parameters:
- InputStartPosition - Offset of start of node
setEndPosition
public void setEndPosition(Position InputEndPosition)
- Set the position of the end of this node relative to the start of the
document it is in.
- Parameters:
- InputEndPosition - Offset of end of node
getPrecedingWhitespace
public String getPrecedingWhitespace()
- Get the value of the preceding whitespace.
- Returns:
- String value or null
getPrecedingWhitespaceLength
public int getPrecedingWhitespaceLength()
- Get the length of the preceding whitespace.
- Returns:
- The length of the preceding whitespace, or 0 if there is none
getChildrenOfType
public Vector getChildrenOfType(String InputNodeType)
- Get all the child nodes of a particular named type.
- Parameters:
- InputNodeType - The name of the type required
- Returns:
- A vector of all the child nodes of the given type; it is empty if
there are no such children.
getChildrenOfType
public Vector getChildrenOfType(int InputNodeType)
- Get all the child nodes of a particular type code.
- Parameters:
- InputNodeType - The ID of the type required
- Returns:
- A vector of all the child nodes of the given type; it is empty if
there are no such children.
getFirstChildOfType
public xg_Node getFirstChildOfType(String InputNodeType)
- Get the first child element of a particular named type.
- Parameters:
- InputNodeType - The name of the type required
- Returns:
- The first child node of the given type (or null if there isn't one).
getChild
public xg_Node getChild(int InputChildIndex)
- Get the child element with the given index.
- Parameters:
- InputChildIndex - The index of the child required
- Returns:
- The child of the given number
getParentNode
public xg_Node getParentNode()
- Get this node's parent.
- Returns:
- The parent of the node
getRootNode
public xg_Node getRootNode()
- Get the top-level node of the tree to which this node belongs.
- Returns:
- The root node of this tree
getAncestorOfType
public xg_Node getAncestorOfType(String InputNodeName)
- Get the first ancestor of this node whose NodeName is InputTypeName (or null
if it doesn't have an ancestor of this type).
- Returns:
- The first ancestor of this node which is of the requested type
getSummaryString
public String getSummaryString()
- Get a summary descriptive string suitable for display in the tree view or
elsewhere. To be overridden in each sub-class.
- Returns:
- A description suitable for display in the tree view
toString
public String toString()
- Return a string representation of the node (intended for use as debug
output).
- Returns:
- String representing the node type
- Overrides:
- toString in class DefaultMutableTreeNode
getDocument
public Document getDocument()
- Get the swing.text.Document associated with this node.
- Returns:
- The swing.text.Document to which this node belongs
getParentElement
public Element getParentElement()
- Get this node's parent (as an Element). If the element is a root level
element, null is returned.
- Returns:
- the parent element
getName
public String getName()
- Get the name of this node. If the node is used to represent some type
of structure, this is its type name.
- Returns:
- The name of this node
getType
public abstract int getType()
- Get the type of this node.
- Returns:
- The type of this node
getNodeType
public int getNodeType()
- Get the type of this node, using only type values defined for the DOM.
(Implements org.w3c.dom.Node.getNodeType.)
- Returns:
- The DOM type of this node
getAttributes
public AttributeSet getAttributes()
- Get a collection of attributes this node contains. This method may be
overridden by derived classes, but a raw node itself has no attributes of
its own and thus the AttributeSet returned contains no attributes itself
- although attributes may be obtained via resolve parent.
- Returns:
- The attributes for the node
getStartOffset
public int getStartOffset()
- Get the offset from the beginning of the document at which this element
begins. If this element has children, this will be the offset of the first
child.
- Returns:
- The starting offset
getEndOffset
public int getEndOffset()
- Get the offset from the beginning of the document at which this element
ends. If this element has children, this will be the end offset of the last
child.
- Returns:
- The ending offset
getElementIndex
public int getElementIndex(int InputOffset)
- Get the child element index closest to the given offset. The offset is
specified relative to the beginning of the document.
- Parameters:
- InputOffset - The offset from the start of the document
- Returns:
- The index of the element which resides at this offset
getElementCount
public int getElementCount()
- Get the number of child elements contained by this element. If this element
is a leaf, a count of zero is returned.
- Returns:
- The number of child elements
getElement
public Element getElement(int InputChildIndex)
- Get the child element at the given index.
- Parameters:
- InputChildIndex - The index of the required child
- Returns:
- The child element
getNodeName
public String getNodeName()
- Get the name of this node. If the node is used to represent some type
of structure, this is its type name.
- Returns:
- The name of this node
hasChildNodes
public boolean hasChildNodes()
- Indicate whether this node has children.
- Returns:
- true if this node has children; false if not
All Packages Class Hierarchy This Package Previous Next Index