Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.msv.reader
Class State

    java.lang.Object
      com.sun.msv.reader.State

All Implemented Interfaces:
  org.xml.sax.ContentHandler

Direct Known Subclasses:
  IgnoreState, NamespaceState, SimpleState

public abstract class State
extends java.lang.Object
implements org.xml.sax.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.

1. 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.
2. After that, startSelf method is called. Usually, this is the place to do something useful.
3. State object is registered as a ContentHandler, and therefore will receive SAX events from now on.
4. Derived classes are expected to do something useful by receiving SAX events.
5. 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

Field Summary
`GrammarReader` | `reader` reader object who is the owner of this object.

Constructor Summary
`State()`

Method Summary
`static void` | `_assert(boolean b)`
`void` | `characters(char[] buffer, int from, int len)`
`void` | `endPrefixMapping(java.lang.String prefix)`
`java.lang.String` | `getBaseURI()`
`org.xml.sax.Locator` | `getLocation()`
`State` | `getParentState()`
`StartTagInfo` | `getStartTag()`
`void` | `ignorableWhitespace(char[] buffer, int from, int len)`
`void` | `processingInstruction(java.lang.String target, java.lang.String data)`
`void` | `setDocumentLocator(org.xml.sax.Locator loc)`
`void` | `skippedEntity(java.lang.String name)`
`void` | `startDocument()`
`void` | `startPrefixMapping(java.lang.String prefix, java.lang.String uri)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.xml.sax.ContentHandler
`endDocument, endElement, startElement`

Field Detail

### reader

    public GrammarReader reader

  reader object who is the owner of this object. This information is avaiable after init method is called.

Constructor Detail

### State

    public State()

Method Detail

### getParentState

    public final State getParentState()

### getStartTag

    public StartTagInfo getStartTag()

### getLocation

    public org.xml.sax.Locator getLocation()

### getBaseURI

    public java.lang.String getBaseURI()

### _assert

    public static void _assert(boolean b)

### characters

    public void characters(char[] buffer,
                           int from,
                           int len)
                    throws org.xml.sax.SAXException

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.String data)
                               throws org.xml.sax.SAXException

  Specified by:
    `processingInstruction` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### ignorableWhitespace

    public void ignorableWhitespace(char[] buffer,
                                    int from,
                                    int len)
                             throws org.xml.sax.SAXException

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### skippedEntity

    public void skippedEntity(java.lang.String name)
                       throws org.xml.sax.SAXException

  Specified by:
    `skippedEntity` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startDocument

    public final void startDocument()
                             throws org.xml.sax.SAXException

  Specified by:
    `startDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator loc)

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`

### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                                   java.lang.String uri)
                            throws org.xml.sax.SAXException

  Specified by:
    `startPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws org.xml.sax.SAXException

  Specified by:
    `endPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD