net.sf.swan.xml.input.pattern
Class PatternsBuilder

java.lang.Object
  |
  +--net.sf.swan.xml.input.pattern.PatternsBuilder
All Implemented Interfaces:
DocumentListener

public class PatternsBuilder
extends java.lang.Object
implements DocumentListener

A component that dispatches events to appropriate handlers based on rules defined using XPath expressions. The expressions are evaluated in a manner akin to XSLT's patterns and must conform to the same constraints, but with the added constraint that child and descendant content is not available to expressions (since they are evaluated against events, not tree nodes). The ancestor hierarchy is, however, available to expressions.


Field Summary
 java.lang.Object matchedPlaceholderKey
           
 java.lang.Object matchedRuleKey
           
 java.lang.Object sourceContextKey
           
 
Constructor Summary
PatternsBuilder()
           
 
Method Summary
 ContextListener contextListener()
          Factory method for creating a ContextListener that dispatches to the appropriate rules for processing.
 void endDocument(DocumentContext context)
           
 Rule match(java.lang.String pattern, ContextListener handler)
           
 void putNamespace(java.lang.String prefix, java.lang.String uri)
           
 void startDocument(DocumentContext context)
           
 Stereotype stereotype()
           
 XPathSupport xpathSupport()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceContextKey

public final java.lang.Object sourceContextKey

matchedRuleKey

public final java.lang.Object matchedRuleKey

matchedPlaceholderKey

public final java.lang.Object matchedPlaceholderKey
Constructor Detail

PatternsBuilder

public PatternsBuilder()
Method Detail

putNamespace

public void putNamespace(java.lang.String prefix,
                         java.lang.String uri)

xpathSupport

public XPathSupport xpathSupport()

stereotype

public Stereotype stereotype()

match

public Rule match(java.lang.String pattern,
                  ContextListener handler)
           throws org.saxpath.SAXPathException

startDocument

public void startDocument(DocumentContext context)
                   throws EventContextException
Specified by:
startDocument in interface DocumentListener

endDocument

public void endDocument(DocumentContext context)
                 throws EventContextException
Specified by:
endDocument in interface DocumentListener

contextListener

public ContextListener contextListener()
Factory method for creating a ContextListener that dispatches to the appropriate rules for processing. Note that it is generally not necessary for clients to use this. When a PatternsBuilder is added to a DocumentContext as a DocumentListener, it will create any ContextListener it needs to receive events.