de.zeigermann.xpa.treeParser
Class XMLStartAST

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--de.zeigermann.xpa.treeParser.XMLAST
                    |
                    +--de.zeigermann.xpa.treeParser.XMLStartAST
All Implemented Interfaces:
AST, Serializable

public class XMLStartAST
extends XMLAST

The XMLStartAST class extends XMLASTs for attributes to represent XML start tags as ASTs. Together with its children and its attributes it forms a complete XML element.

In case it does not contain any children it is supposed to be empty, which can be checked by isEmpty().

Note: There is not need to explicitly represent end tags as they are implied by the structure of the tree!

See Also:
Serialized Form

Field Summary
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
XMLStartAST(int type, String text, AttributesImpl attributes)
          Creates a new XMLStartAST.
XMLStartAST(Token t)
          Creates a new XMLStartAST with no attributes.
XMLStartAST(Token t, AttributesImpl attributes)
          Creates a new XMLStartAST.
XMLStartAST(XMLStartAST e)
          Copy ctor.
 
Method Summary
 AttributesImpl getAttributes()
          Gets attributes associated to this tag.
 boolean isEmpty()
          Finds out if this XMLStartAST is empty.
 void setAttributes(AttributesImpl attributes)
          Sets attributes associated to this tag.
 String toString()
          Gets a simple string representation of this token.
 void updateTokenTypes(XMLTokenTypeManager tokenManager)
          Updates the type of this XMLStartAST determined by token manager and the text of this AST by XMLTokenTypeManager.getType(String).
 void write(XMLWriter writer)
          Writes itself to XML writer.
 
Methods inherited from class de.zeigermann.xpa.treeParser.XMLAST
addSibling, getLastChild, getLastSibling, getPreviousSiblingFlat, noRoot, reverseFlat
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLStartAST

public XMLStartAST(int type,
                   String text,
                   AttributesImpl attributes)
Creates a new XMLStartAST.

Parameters:
type - the type of the AST, usually determined by Parser2XMLASTAdapter using XMLTokenTypeManager.getType(String).
text - name of this start tag
attributes - attributes associated to this tag
See Also:
getAttributes()

XMLStartAST

public XMLStartAST(Token t,
                   AttributesImpl attributes)
Creates a new XMLStartAST.

Parameters:
t - the token to get type and text from
attributes - attributes associated to this tag
See Also:
getAttributes()

XMLStartAST

public XMLStartAST(Token t)
Creates a new XMLStartAST with no attributes.

Parameters:
t - the token to get type and text from

XMLStartAST

public XMLStartAST(XMLStartAST e)
Copy ctor.

Method Detail

toString

public String toString()
Gets a simple string representation of this token. Not intended for writing back to XML.

Specified by:
toString in interface AST
Overrides:
toString in class XMLAST
See Also:
XMLAST.write(de.zeigermann.xml.XMLWriter)

write

public void write(XMLWriter writer)
           throws IOException
Writes itself to XML writer. This method is intended to write back XMLASTs to XML documents.

Overrides:
write in class XMLAST
IOException

updateTokenTypes

public void updateTokenTypes(XMLTokenTypeManager tokenManager)
Updates the type of this XMLStartAST determined by token manager and the text of this AST by XMLTokenTypeManager.getType(String). This is needed when we want to change the token types of an existing XMLAST. As this is the root of a tree, the childrens type will be updated as sell.

Overrides:
updateTokenTypes in class XMLAST

isEmpty

public boolean isEmpty()
Finds out if this XMLStartAST is empty. An XMLStartAST is considered empty if it has no children.


getAttributes

public AttributesImpl getAttributes()
Gets attributes associated to this tag.


setAttributes

public void setAttributes(AttributesImpl attributes)
Sets attributes associated to this tag.



Copyright © 1999-2003 Oliver Zeigermann. All Rights Reserved.