com.simonstl.gorille
Interface ContextI

All Superinterfaces:
NamespaceStackI
All Known Implementing Classes:
Context, LoudContext

public interface ContextI
extends NamespaceStackI

Represents the context for the current event. Events are added to the context _after_ they have been through the filtering process.

Author:
simonstl

Method Summary
 void addNode(StackableComponentI child)
          Adds a childless node.
 void endChild()
          End a node and adjusts context.
 StackableComponentI getCurrent()
          Returns the current node.
 java.lang.String getEncoding()
          Provides access to the encoding information from the XML declaration.
 boolean getExplicitXMLDecl()
          Identifies whether or not the document included an XML declaration.
 java.lang.String getOrigin()
          Returns a string identifying the origin of the document.
 StackableComponentI getParent()
          Returns the component which is the parent of the current node.
 java.lang.String getStandalone()
          Provides access to the standalone information from the XML declaration.
 java.lang.String getVersion()
          Provides access to the version information from the XML declaration.
 boolean isSpace(char c)
          Reports whether the character c is whitespace or not.
 void popLevel()
          Pops the element level up one to undeclare namespaces whose scope is done.
 void pushLevel()
          Pushes the element level one deeper for namespace-nesting.
 void reset()
          clear everything in the namespace stack
 java.lang.String resolveEntity(java.lang.String entName)
          Resolves an entity, hexRef, or decRef.
 void setEncoding(java.lang.String encoding)
          Sets the character encoding of XML used by the document, retrieved from the XML declaration.
 void setEntity(java.lang.String name, java.lang.String value)
          Establishes an entity name-value relationship.
 void setExplicitXMLDecl(boolean happened)
          Identifies whether the document contained an explicit XML declaration.
 void setOrigin(java.lang.String origin)
          Accepts a string identifying the origin of the document.
 void setStandalone(java.lang.String standalone)
          Sets the value of the standalone declaration, retrieved from the XML declaration.
 void setVersion(java.lang.String version)
          Sets the version of XML used by the document, retrieved from the XML declaration.
 boolean setXMLDeclaration(java.lang.String declaration)
          Takes a complete XML declaration for processing; returns false if there's an error.
 void startChild(StackableComponentI child)
          Adds a new node to the stack and adjusts context.
 
Methods inherited from interface com.simonstl.common.NamespaceStackI
declarePrefix, getPrefix, getUri
 

Method Detail

setOrigin

public void setOrigin(java.lang.String origin)
Accepts a string identifying the origin of the document. Most likely a URI stating where it came from.


getOrigin

public java.lang.String getOrigin()
Returns a string identifying the origin of the document. Most likely a URI stating where it came from.


setXMLDeclaration

public boolean setXMLDeclaration(java.lang.String declaration)
Takes a complete XML declaration for processing; returns false if there's an error.

Parameters:
declaration - the complete XML declaration, from

setVersion

public void setVersion(java.lang.String version)
Sets the version of XML used by the document, retrieved from the XML declaration. Should default to "1.0".

Parameters:
version -

getVersion

public java.lang.String getVersion()
Provides access to the version information from the XML declaration.

Returns:
the version of XML used by the document

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the character encoding of XML used by the document, retrieved from the XML declaration. Should default to "1.0".

Parameters:
encoding -

getEncoding

public java.lang.String getEncoding()
Provides access to the encoding information from the XML declaration.

Returns:
the character encoding specified by the document

setStandalone

public void setStandalone(java.lang.String standalone)
Sets the value of the standalone declaration, retrieved from the XML declaration. Should default to "no". "yes" is the other option.

Parameters:
standalone -

getStandalone

public java.lang.String getStandalone()
Provides access to the standalone information from the XML declaration.

Returns:
whether the document declares itself standalone

setExplicitXMLDecl

public void setExplicitXMLDecl(boolean happened)
Identifies whether the document contained an explicit XML declaration.

Parameters:
happened - - true if the document had a decl, false if not

getExplicitXMLDecl

public boolean getExplicitXMLDecl()
Identifies whether or not the document included an XML declaration.

Returns:
the version of XML used by the document

getParent

public StackableComponentI getParent()
Returns the component which is the parent of the current node.


getCurrent

public StackableComponentI getCurrent()
Returns the current node.


startChild

public void startChild(StackableComponentI child)
Adds a new node to the stack and adjusts context.


endChild

public void endChild()
End a node and adjusts context.


addNode

public void addNode(StackableComponentI child)
Adds a childless node.


setEntity

public void setEntity(java.lang.String name,
                      java.lang.String value)
Establishes an entity name-value relationship. The value must be provided directly and not by reference.

Parameters:
name - name of the entity
value - value of the entity

resolveEntity

public java.lang.String resolveEntity(java.lang.String entName)
Resolves an entity, hexRef, or decRef.

Parameters:
entName - the name of the entity or ref, minus the & and ;
Returns:
a string containing either the entity or hex/dec processing result

isSpace

public boolean isSpace(char c)
Reports whether the character c is whitespace or not.

Parameters:
c - a character to test
Returns:
true if it's whitespace, false if it's not

pushLevel

public void pushLevel()
Description copied from interface: NamespaceStackI
Pushes the element level one deeper for namespace-nesting.

Specified by:
pushLevel in interface NamespaceStackI

popLevel

public void popLevel()
Description copied from interface: NamespaceStackI
Pops the element level up one to undeclare namespaces whose scope is done.

Specified by:
popLevel in interface NamespaceStackI

reset

public void reset()
Description copied from interface: NamespaceStackI
clear everything in the namespace stack

Specified by:
reset in interface NamespaceStackI