Package com.sun.msv.reader
Class State
java.lang.Object
com.sun.msv.reader.State
- All Implemented Interfaces:
- ContentHandler
- Direct Known Subclasses:
- IgnoreState,- NamespaceState,- SimpleState
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
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.
SimpleState.
 
 this class also provides:
- access to the parent state
- default implementations for all ContentHandler callbacks except startElement and endElement
- Author:
- Kohsuke KAWAGUCHI
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Stringbase URI for this state.protected LocatorLocation of the start tag.protected Stateparent state of this state.reader object who is the owner of this object.protected StartTagInfoinformation of the start tag.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic void_assert(boolean b) protected final Expressionvoidcharacters(char[] buffer, int from, int len) voidendPrefixMapping(String prefix) final StatevoidignorableWhitespace(char[] buffer, int from, int len) protected final voidinit(GrammarReader reader, State parentState, StartTagInfo startTag) voidprocessingInstruction(String target, String data) voidvoidskippedEntity(String name) final voidvoidstartPrefixMapping(String prefix, String uri) protected voidperforms a task that should be done before reading any child elements.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandlerdeclaration, endDocument, endElement, startElement
- 
Field Details- 
parentStateparent state of this state. In other words, the parent state is a state who is responsible for the parent element of the current element. For states responsible for the document element, the parent state is a state who is responsible for the entire document. For states responsible for the entire document, the parent state is always null.
- 
readerreader object who is the owner of this object. This information is avaiable after init method is called.
- 
startTaginformation of the start tag. This information is avaiable after init method is called.
- 
locationLocation of the start tag. This information is avaiable after init method is called.
- 
baseURIbase URI for this state. This information is avaiable after init method is called.
 
- 
- 
Constructor Details- 
Statepublic State()
 
- 
- 
Method Details- 
getParentState
- 
getStartTag
- 
getLocation
- 
getBaseURI
- 
init
- 
startSelfprotected void startSelf()performs a task that should be done before reading any child elements. derived-class can safely read startTag and/or parentState values.
- 
_assertpublic static void _assert(boolean b) 
- 
characters- Specified by:
- charactersin interface- ContentHandler
- Throws:
- SAXException
 
- 
callInterceptExpression
- 
processingInstruction- Specified by:
- processingInstructionin interface- ContentHandler
- Throws:
- SAXException
 
- 
ignorableWhitespace- Specified by:
- ignorableWhitespacein interface- ContentHandler
- Throws:
- SAXException
 
- 
skippedEntity- Specified by:
- skippedEntityin interface- ContentHandler
- Throws:
- SAXException
 
- 
startDocument- Specified by:
- startDocumentin interface- ContentHandler
- Throws:
- SAXException
 
- 
setDocumentLocator- Specified by:
- setDocumentLocatorin interface- ContentHandler
 
- 
startPrefixMapping- Specified by:
- startPrefixMappingin interface- ContentHandler
- Throws:
- SAXException
 
- 
endPrefixMapping- Specified by:
- endPrefixMappingin interface- ContentHandler
- Throws:
- SAXException
 
 
-