com.sun.msv.reader.relax
Class RELAXReader

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by com.sun.msv.reader.GrammarReader
          extended by com.sun.msv.reader.relax.RELAXReader
All Implemented Interfaces:
IDContextProvider2, org.relaxng.datatype.ValidationContext, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
Direct Known Subclasses:
RELAXCoreReader, RELAXNSReader

public abstract class RELAXReader
extends GrammarReader

reads RELAX grammar/module by SAX2 and constructs abstract grammar model.

Author:
Kohsuke KAWAGUCHI

Nested Class Summary
static class RELAXReader.StateFactory
          creates various State object, which in turn parses grammar.
 
Nested classes/interfaces inherited from class com.sun.msv.reader.GrammarReader
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver
 
Field Summary
static String ERR_ILLEGAL_OCCURS
           
static String ERR_MISPLACED_OCCURS
           
static String RELAXCoreNamespace
          Namespace URI of RELAX Core
 RELAXReader.StateFactory sfactory
           
 
Fields inherited from class com.sun.msv.reader.GrammarReader
backwardReference, basePrefixResolver, controller, ERR_BAD_ATTRIBUTE_VALUE, ERR_BAD_TYPE, ERR_CHARACTERS, ERR_CONFLICTING_ATTRIBUTES, ERR_DATATYPE_ALREADY_DEFINED, ERR_DISALLOWED_ATTRIBUTE, ERR_FRAGMENT_IDENTIFIER, ERR_ILLEGAL_FINAL_VALUE, ERR_MALPLACED_ELEMENT, ERR_MISSING_ATTRIBUTE, ERR_MISSING_ATTRIBUTE_2, ERR_MISSING_CHILD_EXPRESSION, ERR_MISSING_CHILD_TYPE, ERR_MISSING_TOPLEVEL, ERR_MORE_THAN_ONE_CHILD_EXPRESSION, ERR_MORE_THAN_ONE_CHILD_TYPE, ERR_RECURSIVE_DATATYPE, ERR_RECURSIVE_INCLUDE, ERR_RUNAWAY_EXPRESSION, ERR_UNDEFINED_DATATYPE, parserFactory, pool, prefixResolver, WRN_DEPRECATED_TYPENAME, WRN_MAYBE_WRONG_NAMESPACE
 
Constructor Summary
RELAXReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXReader.StateFactory stateFactory, ExpressionPool pool, State initialState)
           
 
Method Summary
protected  boolean canHaveOccurs(State state)
          returns true if the given state can have "occurs" attribute.
 State createExpressionChildState(State parent, StartTagInfo tag)
          this method must be implemented by the derived class to create language-default expresion state.
 FacetState createFacetState(State parent, StartTagInfo tag)
           
protected  ExpressionPool getPool()
           
protected  Expression interceptExpression(State state, Expression exp)
          intercepts an expression made by ExpressionState before it is passed to the parent state.
protected  String localizeMessage(String propertyName, Object[] args)
          formats localized message with arguments
protected abstract  Expression resolveElementRef(String namespace, String label)
          obtains an Expression specified by given (namespace,label) pair.
protected abstract  Expression resolveHedgeRef(String namespace, String label)
          obtains an Expression specified by given (namespace,label) pair.
 
Methods inherited from class com.sun.msv.reader.GrammarReader
_parse, addBackPatchJob, addBackPatchJob, combineURI, combineURL, createParserFactory, detectUndefinedOnes, endPrefixMapping, getBackwardCompatibleType, getBaseUri, getCurrentState, getDeclaredLocationOf, getLocator, getResultAsGrammar, inputSourceFromLSInput, isGrammarElement, isNotation, isUnparsedEntity, iterateInscopeNamespaces, onID, parse, parse, parse, popState, pushState, reportError, reportError, reportError, reportError, reportError, reportError, reportError, reportError, reportWarning, reportWarning, reportWarning, reportWarning, resolveLocation, resolveNamespacePrefix, runBackPatchJob, setDeclaredLocationOf, setDocumentLocator, setLocator, splitQName, startPrefixMapping, switchSource, switchSource, switchSource
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, endElement, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELAXCoreNamespace

public static final String RELAXCoreNamespace
Namespace URI of RELAX Core

See Also:
Constant Field Values

sfactory

public final RELAXReader.StateFactory sfactory

ERR_ILLEGAL_OCCURS

public static final String ERR_ILLEGAL_OCCURS
See Also:
Constant Field Values

ERR_MISPLACED_OCCURS

public static final String ERR_MISPLACED_OCCURS
See Also:
Constant Field Values
Constructor Detail

RELAXReader

public RELAXReader(GrammarReaderController controller,
                   SAXParserFactory parserFactory,
                   RELAXReader.StateFactory stateFactory,
                   ExpressionPool pool,
                   State initialState)
Method Detail

createExpressionChildState

public State createExpressionChildState(State parent,
                                        StartTagInfo tag)
Description copied from class: GrammarReader
this method must be implemented by the derived class to create language-default expresion state.

Specified by:
createExpressionChildState in class GrammarReader
Returns:
null if the start tag is an error.

createFacetState

public FacetState createFacetState(State parent,
                                   StartTagInfo tag)

canHaveOccurs

protected boolean canHaveOccurs(State state)
returns true if the given state can have "occurs" attribute.


interceptExpression

protected Expression interceptExpression(State state,
                                         Expression exp)
Description copied from class: GrammarReader
intercepts an expression made by ExpressionState before it is passed to the parent state. derived class can perform further wrap-up before it is received by the parent. This mechanism is used by RELAXReader to handle occurs attribute.

Overrides:
interceptExpression in class GrammarReader

resolveElementRef

protected abstract Expression resolveElementRef(String namespace,
                                                String label)
obtains an Expression specified by given (namespace,label) pair. this method is called to parse <ref label="..." /> element.


resolveHedgeRef

protected abstract Expression resolveHedgeRef(String namespace,
                                              String label)
obtains an Expression specified by given (namespace,label) pair. this method is called to parse <hedgeRef label="..." /> element.


localizeMessage

protected String localizeMessage(String propertyName,
                                 Object[] args)
Description copied from class: GrammarReader
formats localized message with arguments

Specified by:
localizeMessage in class GrammarReader

getPool

protected ExpressionPool getPool()


MSV