Top Description Fields Constructors Methods
com.sun.msv.reader

public abstract Class SimpleState

extends State
Class Inheritance
Known Direct Subclasses
com.sun.msv.reader.datatype.xsd.TypeState, com.sun.msv.reader.relax.HedgeRuleBaseState, com.sun.msv.reader.relax.core.ClauseState, com.sun.msv.reader.relax.core.DivInModuleState, com.sun.msv.reader.relax.core.ElementRuleBaseState, com.sun.msv.reader.relax.core.InterfaceState, com.sun.msv.reader.relax.core.RootModuleMergeState, com.sun.msv.reader.relax.core.RootModuleState, com.sun.msv.reader.trex.DefineState, com.sun.msv.reader.trex.IncludeMergeState, com.sun.msv.reader.trex.NameClassState, com.sun.msv.reader.trex.RootIncludedPatternState, com.sun.msv.reader.trex.RootMergedGrammarState, com.sun.msv.reader.xmlschema.GlobalDeclState, com.sun.msv.reader.xmlschema.IdentityConstraintState, com.sun.msv.reader.xmlschema.RootIncludedSchemaState, com.sun.msv.relaxns.reader.GrammarState, com.sun.msv.relaxns.reader.RootGrammarMergeState, com.sun.msv.relaxns.reader.RootGrammarState, com.sun.msv.reader.ChildlessState, com.sun.msv.reader.ExpressionState
Imports
org.xml.sax.Attributes, .Locator, org.xml.sax.helpers.AttributesImpl, com.sun.msv.util.StartTagInfo

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

Field Summary

Inherited from com.sun.msv.reader.State:
baseURIlocationparentStatereaderstartTag

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract State
createChildState(StartTagInfo tag)

creates appropriate child state object for this element

public final void
endDocument()

Implements org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of a document.
public final void
endElement(String
the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
namespaceURI
,
String
the local name (without prefix), or the empty string if Namespace processing is not being performed
localName
,
String
the qualified XML name (with prefix), or the empty string if qualified names are not available
qName
)

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.
protected void
endSelf()

this method is called in endElement method when the state is about to be removed.

protected boolean
isGrammarElement(StartTagInfo tag)

checks if this element belongs to the grammar.

public void
startElement(String
the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
namespaceURI
,
String
the local name (without prefix), or the empty string if Namespace processing is not being performed
localName
,
String
the qualified name (with prefix), or the empty string if qualified names are not available
qName
,
Attributes
the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined
atts
)

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the beginning of an element.
Inherited from com.sun.msv.reader.State:
_assertcallInterceptExpressioncharactersendPrefixMappinggetBaseURIgetLocationgetParentStategetStartTagignorableWhitespaceinitprocessingInstructionsetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingstartSelf

Constructor Detail

SimpleStateback to summary
public SimpleState()

Method Detail

createChildStateback to summary
protected abstract State createChildState(StartTagInfo tag)

creates appropriate child state object for this element

endDocumentback to summary
public final void endDocument()

Implements org.xml.sax.ContentHandler.endDocument.

Doc from org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of a document.

This method is invoked by the parser to signal it has reached the end of the document after successfully completing the parsing process. After the event, the parser will return the control to the application.

endElementback to summary
public final void endElement(String namespaceURI, String localName, String qName)

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement event for every endElement event (even when the element is empty).

For information on the names, see startElement.

Parameters
namespaceURI:String

the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed

localName:String

the local name (without prefix), or the empty string if Namespace processing is not being performed

qName:String

the qualified XML name (with prefix), or the empty string if qualified names are not available

endSelfback to summary
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

isGrammarElementback to summary
protected boolean isGrammarElement(StartTagInfo tag)

checks if this element belongs to the grammar.

startElementback to summary
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.ContentHandler.startElement.

Receive notification of the beginning of an element.

The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.

This event allows up to three name components for each element:

  1. the Namespace URI;
  2. the local name; and
  3. the qualified (prefixed) name.

Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:

  • the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
  • the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).

Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes property is true (it is false by default, and support for a true value is optional).

Like characters(), attribute values may have characters that need more than one char value.

Parameters
namespaceURI:String

the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed

localName:String

the local name (without prefix), or the empty string if Namespace processing is not being performed

qName:String

the qualified name (with prefix), or the empty string if qualified names are not available

atts:Attributes

the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined