com.sun.msv.reader
Class State
java.lang.Object
|
+--com.sun.msv.reader.State
- All Implemented Interfaces:
- ContentHandler
- Direct Known Subclasses:
- IgnoreState, NamespaceState, SimpleState
- public abstract class State
- extends Object
- implements ContentHandler
base interface of 'parsing state'.
parsing of XML representation of a grammar is done by
using various states.
Each State-derived class is responsible for a particular type of
declaration of the grammar. For example, SequenceState is responsible
for parsing <sequence> element of RELAX module.
State objects interact each other. There are two ways of interaction.
- from parent to child
- from child to parent
The first type of communication occurs only when a child state object is
created. The last type of communication occurs usually (but not limited to)
when a child state sees its end tag.
In this level of inheritance, contract is somewhat abstract.
- When a State object is created, its init method is called
and various information is set. Particularly, start tag
information (if any) and the parent state is set.
This process should only be initiated by GrammarReader.
- After that, startSelf method is called. Usually,
this is the place to do something useful.
- State object is registered as a ContentHandler, and
therefore will receive SAX events from now on.
- Derived classes are expected to do something useful
by receiving SAX events.
- When a State object finishes its own part, it should
call GrammarReader.popState method. It will remove
the current State object and registers the parent state
as a ContentHandler again.
Of course some derived classes introduce more restricted
contract. See SimpleState.
this class also provides:
- access to the parent state
- default implementations for all ContentHandler callbacks
except startElement and endElement
- Author:
- Kohsuke KAWAGUCHI
|
Constructor Summary |
State()
|
reader
public GrammarReader reader
- reader object who is the owner of this object.
This information is avaiable after init method is called.
State
public State()
getStartTag
public StartTagInfo getStartTag()
getLocation
public Locator getLocation()
getBaseURI
public String getBaseURI()
characters
public void characters(char[] buffer,
int from,
int len)
- Specified by:
characters in interface ContentHandler
processingInstruction
public void processingInstruction(String target,
String data)
- Specified by:
processingInstruction in interface ContentHandler
ignorableWhitespace
public void ignorableWhitespace(char[] buffer,
int from,
int len)
- Specified by:
ignorableWhitespace in interface ContentHandler
skippedEntity
public void skippedEntity(String name)
- Specified by:
skippedEntity in interface ContentHandler
startDocument
public final void startDocument()
- Specified by:
startDocument in interface ContentHandler
setDocumentLocator
public void setDocumentLocator(Locator loc)
- Specified by:
setDocumentLocator in interface ContentHandler
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
- Specified by:
startPrefixMapping in interface ContentHandler
endPrefixMapping
public void endPrefixMapping(String prefix)
- Specified by:
endPrefixMapping in interface ContentHandler