    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class xe.xe_Parser

    java.lang.Object
       |
       +----xe.xe_Parser

public abstract class xe_Parser
extends Object

Abstract base class for the parsing of any part of an XML document. It implements some common operations required by most parser derived classes. It is not a complete class, and requires a concrete implementation.

##

EntityClassName
  Name of the class used to represent entities of this type.
EntityName
  The name of the entity currently being parsed.
EntityType
  The type of the entity currently being parsed.
NodePrecedingWhitespace
  If the node currently being parsed was preceded by whitespace in the source, this is it.
ParentNode
  The parent of the node currently being parsed.
TheParseManager
  The parse manager controlling the current parse.

##

xe_Parser()

##

createNode(String)
  Create an entity of the type suitable for the entity whose type is in the EntityName attribute.
parse()
  Attempt to parse the next entity.
parse(xe_ParseManager)
  Attempt to parse the next entity.
parseAttribute(xe_Token)
  Parse an attribute (ie.
parseNextEntity(xe_Token, xg_Node)
  Parse the next entity, assuming its start (ie.
setEntityClassName(String)
  Set the name of the class used to represent entities of this type.
setEntityName(String)
  Set the name of the entity currently being parsed.
setEntityType(int)
  Set the type of the entity currently being parsed.
setNodePrecedingWhitespace(String)
  Set the value of the preceding whitespace of the node currently being parsed.
setParentNode(xg_Node)
  Set the parent of the entity currently being parsed.
setParseManager(xe_ParseManager)
  Set the parse manager.

##

EntityType

     protected int EntityType

  The type of the entity currently being parsed.

EntityName

     protected String EntityName

  The name of the entity currently being parsed. (Note that this may bear no direct relationship to the EntityType.)

NodePrecedingWhitespace

     protected String NodePrecedingWhitespace

  If the node currently being parsed was preceded by whitespace in the source, this is it.

ParentNode

     protected xg_Node ParentNode

  The parent of the node currently being parsed.

EntityClassName

     protected String EntityClassName

  Name of the class used to represent entities of this type.

TheParseManager

     protected xe_ParseManager TheParseManager

  The parse manager controlling the current parse.

##

xe_Parser

     public xe_Parser()

##

parse

     public xg_Node parse(xe_ParseManager InputParseManager) throws xm_ParseException, IOException

  Attempt to parse the next entity. Any parse errors result in an IOException. This will either be IOException or xm_ParseException.

  Parameters:
    InputParseManager - Controls parsing
  Returns:
    The parsed xg_Node derived class
  Throws: xm_ParseException
    XML wellformedness error
  Throws: IOException
    Error reading from source reader

parse

     public abstract xg_Node parse() throws xm_ParseException, IOException

  Attempt to parse the next entity. Any parse errors result in either an IOException or xm_ParseException. This allows calling classes to handle errors in whatever way they see fit.

  Returns:
    The parsed xg_Node derived class
  Throws: xm_ParseException
    XML wellformedness error
  Throws: IOException
    Error reading from source reader

parseNextEntity

     protected xg_Node parseNextEntity(xe_Token InputEntityStartToken,
                                       xg_Node InputParentNode) throws xm_ParseException, IOException

  Parse the next entity, assuming its start (ie. its name) has already been parsed. identified by the given node name, and then add it to its InputParentNode.

  Parameters:
    InputEntityStartToken - The first token of the new node, which has already been parsed
    InputParentNode - The parent to which the newly-parsed node belongs
  Returns:
    The node parsed
  Throws: xm_ParseException
    XML wellformedness error
  Throws: IOException
    Error reading from source reader

parseAttribute

     public xg_Attribute parseAttribute(xe_Token InputFirstToken) throws xm_ParseException, IOException

  Parse an attribute (ie. name/value pair), assuming that the attribute's name has already been parsed. An exception is throw if the tokens parsed do not constitute an attribute. Attributes have the form: Name = "Value"

  Parameters:
    InputFirstToken - The first token of the attribute (which will be preceding whitespace and its name)
  Returns:
    A new attribute
  Throws: xm_ParseException
    XML wellformedness error
  Throws: IOException
    Error reading from source reader

createNode

     public xg_Node createNode(String InputUsualClassName) throws xm_ParseException

  Create an entity of the type suitable for the entity whose type is in the EntityName attribute. The entity created is guaranteed to be an instance of the class whose name is InputUsualClassName - or a derived class. This is no more than a convenience method: derived Parsers can call it with fewer parameters than the call we make in here.

  Parameters:
    InputUsualClassName - The name of the class which is usually used to represent entities of the requested type
  Returns:
    Newly-created node
  Throws: xm_ParseException
    Error creating the new node

setEntityType

     public void setEntityType(int InputNodeType)

  Set the type of the entity currently being parsed.

  Parameters:
    InputNodeType - Type of this entity

setEntityName

     public void setEntityName(String InputEntityName)

  Set the name of the entity currently being parsed. (Note that this may bear no direct relationship to the EntityType.)

  Parameters:
    InputEntityName - Name of current entity

setNodePrecedingWhitespace

     public void setNodePrecedingWhitespace(String InputNodePrecedingWhitespace)

  Set the value of the preceding whitespace of the node currently being parsed.

  Parameters:
    InputNodePrecedingWhitespace - Value of the preceding whitespace

setParentNode

     public void setParentNode(xg_Node InputParentNode)

  Set the parent of the entity currently being parsed.

  Parameters:
    InputParentNode - Parent of entity currently being parsed

setEntityClassName

     public void setEntityClassName(String InputEntityClassName)

  Set the name of the class used to represent entities of this type.

  Parameters:
    InputEntityClassName - Name of entity class

setParseManager

     public void setParseManager(xe_ParseManager InputParseManager)

  Set the parse manager.

  Parameters:
    InputParseManager - Controls parsing

    All Packages  Class Hierarchy  This Package  Previous  Next  Index