Class SimpleState

java.lang.Object
com.sun.msv.reader.State
com.sun.msv.reader.SimpleState
All Implemented Interfaces:
ContentHandler
Direct Known Subclasses:
AttPoolState, ChildlessState, DefineState, DivInModuleState, ElementRuleWithHedgeState, ElementRuleWithTypeState, ExpressionState, GlobalDeclState, GrammarState, HedgeRuleBaseState, IdentityConstraintState, IncludeMergeState, InlineTagState, InterfaceState, ListState, NameClassState, RestrictionState, RootGrammarState, RootIncludedPatternState, RootIncludedSchemaState, RootMergedGrammarState, SimpleTypeState, TagState, UnionState

public abstract class SimpleState extends State
base interface of the most of parsing states.

In this level of inheritance, contract is as follows.

  1. startElement() event is received by the parent state. It usually creates a child state by this event.
  2. startSelf method of the child SimpleState is called. derived classes should perform necessary things by reading start tag information.
  3. Whenever startElement method is received by SimpleState object, createChildState method is called to create a child state. Derived classes are responsible for providing appropriate child state objects.
  4. Child state handles descendants. Usually, it finishes parsing when it sees endElement.
  5. When endElement() event is received by this object, it calls endSelf method and reverts to the parent state. Derived classes are responsible for doing anything necessary within endSelf method.
In other words, this state is only active for one hierarchy of XML elements and derived classes are responsible for three abstract methods.
Author:
Kohsuke KAWAGUCHI
  • Constructor Details

    • SimpleState

      public SimpleState()
  • Method Details

    • isGrammarElement

      protected boolean isGrammarElement(StartTagInfo tag)
      checks if this element belongs to the grammar.
    • startElement

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

      protected abstract State createChildState(StartTagInfo tag)
      creates appropriate child state object for this element
    • endElement

      public final void endElement(String namespaceURI, String localName, String qName)
    • endDocument

      public final void endDocument()
    • endSelf

      protected void endSelf()
      this method is called in endElement method when the state is about to be removed. derived-class should perform any wrap-up job