    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class xg.xg_Element

    java.lang.Object
       |
       +----com.sun.java.swing.tree.DefaultMutableTreeNode
               |
               +----xg.xg_Node
                       |
                       +----xg.xg_Element

public class xg_Element
extends xg_Node

An XML element.

##

ElementAttList
  List of this element's attributes.
TrailingWhitespace
  If this node has whitespace prior to its end tag, this is it.

##

xg_Element()
  Construct an element with no name.
xg_Element(String)
  Construct an element with a name.

##

addAttribute(String, String)
  Add an attribute, given its name and value.
addAttribute(xg_Attribute)
  Add an attribute.
getAttList()
  Get the list of attributes.
getAttribute(String)
  Get a named attribute.
getAttributes()
  Get the collection of attributes this element contains.
getAttributeValue(String)
  Get the value of a named attribute.
getAttributeValueVerified(String)
  Get the value of a named attribute, and throwing a verification exception if it is missing.
getTrailingWhitespace()
  Get the value of the whitespace before the end tag.
getType()
  Get the type of this node.
save(Writer)
  Save this element (and its children) in XML source form in InputWriter.
saveContent(Writer)
  Save this element's content (ie.
saveEndTag(Writer)
  Save this element's end tag in XML source form in InputWriter.
saveStartTag(Writer)
  Save this element's start tag in XML source form in InputWriter.
setAttList(xg_AttList)
  Set the list of attributes.
setParentNode(xg_Node)
  Set the parent of this node.
setTrailingWhitespace(String)
  Set the value of the whitespace before the end tag.
toString()
  Return a string representation of the element (intended for use as debug output).

##

ElementAttList

     protected xg_AttList ElementAttList

  List of this element's attributes.

TrailingWhitespace

     protected String TrailingWhitespace

  If this node has whitespace prior to its end tag, this is it.

##

xg_Element

     public xg_Element()

  Construct an element with no name.

xg_Element

     public xg_Element(String InputNodeName)

  Construct an element with a name.

  Parameters:
    InputNodeName - The name of the element

##

save

     public void save(Writer InputWriter) throws IOException

  Save this element (and its children) in XML source form in InputWriter.

  Parameters:
    InputWriter - The writer to which the XML will be written
  Overrides:
    save in class xg_Node

saveStartTag

     public void saveStartTag(Writer InputWriter) throws IOException

  Save this element's start tag in XML source form in InputWriter.

  Parameters:
    InputWriter - The writer to which the XML will be written

saveContent

     public void saveContent(Writer InputWriter) throws IOException

  Save this element's content (ie. its children).

  Parameters:
    InputWriter - The writer to which the XML will be written

saveEndTag

     public void saveEndTag(Writer InputWriter) throws IOException

  Save this element's end tag in XML source form in InputWriter. If this is an empty element, do nothing.

  Parameters:
    InputWriter - The writer to which the XML will be written

addAttribute

     public boolean addAttribute(String InputAttName,
                                 String InputAttValue)

  Add an attribute, given its name and value.

  Parameters:
    InputAttName - The name of this attribute
    InputAttValue - The value of this attribute
  Returns:
    Flag indicating success (true) or failure. Failure only occurs if an attribute with this name already exists (which is an XML well-formedness error).

addAttribute

     public boolean addAttribute(xg_Attribute InputAttribute)

  Add an attribute.

  Parameters:
    InputAttribute - The attribute to be added
  Returns:
    Flag indicating success (true) or failure. Failure only occurs if an attribute with this name already exists (which is an XML well-formedness error).

setAttList

     public void setAttList(xg_AttList InputAttList)

  Set the list of attributes. That is, replace the current attribute list with a completely new one. This is a rather dangerous practice, which should be done only if you know what you're doing. This method was added to support the case where some temporary changes are required, and for the original attribute list to be restored later.

  Parameters:
    InputAttList - A replacement list of attributes

setTrailingWhitespace

     public void setTrailingWhitespace(String InputTrailingWhitespace)

  Set the value of the whitespace before the end tag.

  Parameters:
    InputTrailingWhitespace - Value of the trailing whitespace

setParentNode

     public void setParentNode(xg_Node InputParentNode)

  Set the parent of this node. This overrides the method in xg_Node in order to set the resolve parent (if the parent is an xg_Element).

  Parameters:
    ParentNode - The parent of this node
  Overrides:
    setParentNode in class xg_Node

getType

     public int getType()

  Get the type of this node.

  Returns:
    The type of this node
  Overrides:
    getType in class xg_Node

getAttList

     public xg_AttList getAttList()

  Get the list of attributes.

  Returns:
    The list of attributes

getAttributeValue

     public String getAttributeValue(String InputAttName)

  Get the value of a named attribute.

  Parameters:
    InputAttName - The name of the attribute required
  Returns:
    The value of the named attribute (or null if there is no attribute with this name).

getAttributeValueVerified

     public String getAttributeValueVerified(String InputAttName) throws xg_VerificationException

  Get the value of a named attribute, and throwing a verification exception if it is missing.

  Parameters:
    InputAttName - The name of the attribute required
  Returns:
    The value of the named attribute (or null if there is no attribute with this name).
  Throws: xg_VerificationException
    The attribute is missing

getAttribute

     public xg_Attribute getAttribute(String InputAttName)

  Get a named attribute.

  Parameters:
    InputAttName - The name of the attribute required
  Returns:
    The named attribute (or null if there is no attribute with this name).

getAttributes

     public AttributeSet getAttributes()

  Get the collection of attributes this element contains.

  Returns:
    The attributes for the element
  Overrides:
    getAttributes in class xg_Node

getTrailingWhitespace

     public String getTrailingWhitespace()

  Get the value of the whitespace before the end tag.

  Returns:
    String value or null

toString

     public String toString()

  Return a string representation of the element (intended for use as debug output).

  Returns:
    String representing the node name and its type.
  Overrides:
    toString in class xg_Node

    All Packages  Class Hierarchy  This Package  Previous  Next  Index