Top Description Fields Constructors Methods
ch.qos.logback.core.joran.spi

public Class SaxEventInterpreter

Additional top-level class in compilation unit: CAI_WithLocatorSupport.

extends Object
Class Inheritance
Imports
java.util.List, .Stack, java.util.function.Supplier, org.xml.sax.Attributes, .Locator, ch.qos.logback.core.Context, ch.qos.logback.core.joran.action.Action, .NOPAction, ch.qos.logback.core.joran.event.BodyEvent, .EndEvent, .SaxEvent, .StartEvent, ch.qos.logback.core.spi.ContextAwareImpl

SaxEventInterpreter is Joran's driving class for handling "low-level" SAX events. It extends SAX DefaultHandler which invokes various actions according to predefined patterns.

Patterns are kept in a RuleStore which is programmed to store and then later produce the applicable actions for a given pattern.

The pattern corresponding to a top level <a> element is the string "a".

The pattern corresponding to an element <b> embedded within a top level <a> element is the string "a/b".

The pattern corresponding to an <b> and any level of nesting is "*/b. Thus, the * character placed at the beginning of a pattern serves as a wildcard for the level of nesting. Conceptually, this is very similar to the API of commons-digester. Joran offers several small advantages. First and foremost, it offers support for implicit actions which result in a significant leap in flexibility. Second, in our opinion better error reporting capability. Third, it is self-reliant. It does not depend on other APIs, in particular commons-logging which is too unreliable. Last but not least, Joran is quite tiny and is expected to remain so.

Author
Ceki Gülcü

Field Summary

Modifier and TypeField and Description
pack-priv Stack<Action>
actionStack

The <id>actionStack</id> contain the action that is executing for the given XML element.

private final CAI_WithLocatorSupport
pack-priv Context
private ElementPath
pack-priv EventPlayer
private Supplier<Action>
private final SaxEventInterpretationContext
pack-priv Locator
private static Action
private final RuleStore
pack-priv ElementPath
skip

If the skip nested is set, then we skip all its nested elements until it is set back to null at when the element's end is reached.

Constructor Summary

AccessConstructor and Description
public
SaxEventInterpreter(Context context, RuleStore rs, ElementPath initialElementPath, List<SaxEvent> saxEvents)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
callBeginAction(Action applicableAction, String tagName, Attributes atts)

private void
callBodyAction(Action applicableAction, String body)

private void
callEndAction(Action applicableAction, String tagName)

public void
public void
endElement(EndEvent endEvent)

private void
endElement(String namespaceURI, String localName, String qName)

pack-priv Action
getApplicableAction(ElementPath elementPath, Attributes attributes)

Return the list of applicable patterns for this

public ElementPath
public EventPlayer
public Locator
public RuleStore
public SaxEventInterpretationContext
pack-priv String
getTagName(String localName, String qName)

private void
pushEmptyActionOntoActionStack()

This method is used to

public void
public void
public void
public void
private void
startElement(String namespaceURI, String localName, String qName, Attributes atts)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actionStackback to summary
pack-priv Stack<Action> actionStack

The <id>actionStack</id> contain the action that is executing for the given XML element. An action is pushed by the {link #startElement} and popped by endElement.

caiback to summary
private final CAI_WithLocatorSupport cai
contextback to summary
pack-priv Context context
elementPathback to summary
private ElementPath elementPath
eventPlayerback to summary
pack-priv EventPlayer eventPlayer
implicitActionSupplierback to summary
private Supplier<Action> implicitActionSupplier
interpretationContextback to summary
private final SaxEventInterpretationContext interpretationContext
locatorback to summary
pack-priv Locator locator
NOP_ACTION_SINGLETONback to summary
private static Action NOP_ACTION_SINGLETON
ruleStoreback to summary
private final RuleStore ruleStore
skipback to summary
pack-priv ElementPath skip

If the skip nested is set, then we skip all its nested elements until it is set back to null at when the element's end is reached.

Constructor Detail

SaxEventInterpreterback to summary
public SaxEventInterpreter(Context context, RuleStore rs, ElementPath initialElementPath, List<SaxEvent> saxEvents)

Method Detail

callBeginActionback to summary
pack-priv void callBeginAction(Action applicableAction, String tagName, Attributes atts)
callBodyActionback to summary
private void callBodyAction(Action applicableAction, String body)
callEndActionback to summary
private void callEndAction(Action applicableAction, String tagName)
charactersback to summary
public void characters(BodyEvent be)
endElementback to summary
public void endElement(EndEvent endEvent)
endElementback to summary
private void endElement(String namespaceURI, String localName, String qName)
getApplicableActionback to summary
pack-priv Action getApplicableAction(ElementPath elementPath, Attributes attributes)

Return the list of applicable patterns for this

getCopyOfElementPathback to summary
public ElementPath getCopyOfElementPath()
getEventPlayerback to summary
public EventPlayer getEventPlayer()
getLocatorback to summary
public Locator getLocator()
getRuleStoreback to summary
public RuleStore getRuleStore()
getSaxEventInterpretationContextback to summary
public SaxEventInterpretationContext getSaxEventInterpretationContext()
getTagNameback to summary
pack-priv String getTagName(String localName, String qName)
pushEmptyActionOntoActionStackback to summary
private void pushEmptyActionOntoActionStack()

This method is used to

setDocumentLocatorback to summary
public void setDocumentLocator(Locator l)
setImplicitActionSupplierback to summary
public void setImplicitActionSupplier(Supplier<Action> actionSupplier)
startDocumentback to summary
public void startDocument()
startElementback to summary
public void startElement(StartEvent se)
startElementback to summary
private void startElement(String namespaceURI, String localName, String qName, Attributes atts)