Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.sapia.util.xml.parser;
  
  
  // Imports of David Meggison's SAX classes
  // ---------------------------------------
The HandlerContextIF interface represents the context in which the handlers of SAX events are stacked. It provides methods set the current and remove a HandlerStateIF object. This context behaves like a stack where each new handler added to this context becomes the "current" one. When you remove that current state, the previous state now becomes the "current" one.

This context also provides a way to gather results generated by the different handler that it contains. For more detail see the methods setResultFor() and getResultFor().

Author(s):
Jean-Cedric Desrochers
Copyright:
Copyright &.169; 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See also:
HandlerStateIF
StatefullSAXHandler
 
 public interface HandlerContextIF {
  
Returns the current handler state of this context.

Returns:
The current handler state of this context.
 
   public HandlerStateIF getCurrentState();

  
Changes the current handler state to the handler state passed in. The collection of state objects needs to behave like a stack (LIFO - Last in, first out) in order to go back to the previous state of a handler.

The handler context will notify the child handler state of the start of the element by calling it's startElement() method passing the arguments received.

Parameters:
aHandlerState The new current handler state.
anUri The namespace URI of the element that starts.
aLocalName The local name of the element that starts.
aQualifiedName The qualified name of the element that starts.
someAttributes The attributes of the element that starts.
Throws:
org.xml.sax.SAXException If an error occurs while setting the new handler state.
 
   public void setCurrentState(HandlerStateIF aHandlerStateString anUri,
     String aLocalNameString aQualifiedNameAttributes someAttributes)
     throws SAXException;

  
Removes the current handler state from this handler context. The previous handler state becomes the current state.

The handler context will notify the parent handler state of the end of the element by calling it's endElement() method passing the arguments received.

Parameters:
anURI The namespace URI of the element that closes.
aLocalName The local name of the element that closes.
aQualifiedName The qualified name of the element that closes.
Throws:
org.xml.sax.SAXException If an error occurs while removing the new handler state.
 
   public void removeCurrentState(String anUriString aLocalName,
     String aQualifiedNamethrows SAXException;

  
Sets the namespace URI passed in as the current mapping for the given prefix.

Parameters:
aPrefix The Namespace prefix being declared.
anUri The Namespace URI mapped to the prefix.
 
   public void startPrefixMapping(String aPrefixString anUri);

  
Removes the current mapping of the prefix passed in.

Parameters:
aPrefix The Namespace prefix being declared.
 
   public void endPrefixMapping(String aPrefix);

  
Returns the current namespace URI for the passed in prefix.

Returns:
The current namespace URI or null if not mapping exists.
 
   public String getNamespaceURIFor(String aPrefix);

  
associates the result object to the handler state passed in.

Parameters:
aHandlerState The handler state for which a result is provided.
aResult The result object of the handler state.
  public void setResultFor(HandlerStateIF aHandlerStateObject aResult);

  
Returns the result for the handler state passed in.

Parameters:
aHandlerState The handler state for which to search for a result.
Returns:
The result object found, or null if no handler state was foud or if no result was associated for the handler state passed in.
  public Object getResultFor(HandlerStateIF aHandlerState);
New to GrepCode? Check out our FAQ X