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.


Variable Index

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

Constructor Index

 o xe_Parser()

Method Index

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

Variables

 o EntityType
 protected int EntityType
The type of the entity currently being parsed.

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

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

 o ParentNode
 protected xg_Node ParentNode
The parent of the node currently being parsed.

 o EntityClassName
 protected String EntityClassName
Name of the class used to represent entities of this type.

 o TheParseManager
 protected xe_ParseManager TheParseManager
The parse manager controlling the current parse.

Constructors

 o xe_Parser
 public xe_Parser()

Methods

 o 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
 o 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
 o 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
 o 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
 o 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
 o setEntityType
 public void setEntityType(int InputNodeType)
Set the type of the entity currently being parsed.

Parameters:
InputNodeType - Type of this entity
 o 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
 o 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
 o setParentNode
 public void setParentNode(xg_Node InputParentNode)
Set the parent of the entity currently being parsed.

Parameters:
InputParentNode - Parent of entity currently being parsed
 o 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
 o setParseManager
 public void setParseManager(xe_ParseManager InputParseManager)
Set the parse manager.

Parameters:
InputParseManager - Controls parsing

All Packages  Class Hierarchy  This Package  Previous  Next  Index