com.sun.msv.reader.trex
Class TREXBaseReader

java.lang.Object
  |
  +--org.xml.sax.helpers.XMLFilterImpl
        |
        +--com.sun.msv.reader.GrammarReader
              |
              +--com.sun.msv.reader.trex.TREXBaseReader
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, IDContextProvider, ValidationContext, XMLFilter, XMLReader
Direct Known Subclasses:
RELAXNGReader, TREXGrammarReader

public abstract class TREXBaseReader
extends GrammarReader

reads TREX grammar from SAX2 and constructs abstract grammar model.

Author:
Kohsuke KAWAGUCHI

Inner Class Summary
static class TREXBaseReader.StateFactory
          creates various State object, which in turn parses grammar.
 
Inner classes inherited from class com.sun.msv.reader.GrammarReader
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver
 
Field Summary
static String ERR_BAD_COMBINE
           
static String ERR_COMBINE_MISSING
           
static String ERR_DUPLICATE_DEFINITION
           
static String ERR_INTERLEAVED_STRING
           
static String ERR_MISSING_CHILD_NAMECLASS
           
static String ERR_MORE_THAN_ONE_NAMECLASS
           
static String ERR_NONEXISTENT_PARENT_GRAMMAR
           
static String ERR_REPEATED_STRING
           
static String ERR_SEQUENCED_STRING
           
static String ERR_UNDECLARED_PREFIX
           
static String ERR_UNDEFINED_PATTERN
           
static String ERR_UNKNOWN_DATATYPE_VOCABULARY
           
 TREXBaseReader.StateFactory sfactory
           
static String WRN_COMBINE_IGNORED
           
static String WRN_OBSOLETED_XMLSCHEMA_NAMSPACE
           
 
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_ILLEGAL_FINAL_VALUE, ERR_IO_EXCEPTION, 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_SAX_EXCEPTION, ERR_UNDEFINED_DATATYPE, ERR_XMLPARSERFACTORY_EXCEPTION, hadError, locator, parserFactory, pool, prefixResolver, WRN_DEPRECATED_TYPENAME, WRN_MAYBE_WRONG_NAMESPACE
 
Constructor Summary
TREXBaseReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, ExpressionPool pool, TREXBaseReader.StateFactory stateFactory, State rootState)
          full constructor
 
Method Summary
 State createExpressionChildState(State parent, StartTagInfo tag)
          this method must be implemented by the derived class to create language-default expresion state.
 void endElement(String a, String b, String c)
           
 TREXGrammar getResult()
          obtains parsed grammar object only if parsing was successful.
 Grammar getResultAsGrammar()
          gets the parsed AGM.
 String getTargetNamespace()
           
 void startElement(String a, String b, String c, Attributes d)
           
 void wrapUp()
          performs final wrap-up.
 
Methods inherited from class com.sun.msv.reader.GrammarReader
addBackPatchJob, combineURL, detectUndefinedOnes, endPrefixMapping, getBackwardCompatibleType, getCurrentState, getDeclaredLocationOf, isNotation, isUnparsedEntity, onID, onIDREF, parse, parse, popState, pushState, reportError, reportError, reportError, reportError, reportError, reportError, reportError, reportError, reportWarning, reportWarning, reportWarning, resolveDataType, resolveLocation, resolveNamespacePrefix, setDeclaredLocationOf, setDocumentLocator, splitQName, startPrefixMapping, switchSource
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sfactory

public final TREXBaseReader.StateFactory sfactory

ERR_MISSING_CHILD_NAMECLASS

public static final String ERR_MISSING_CHILD_NAMECLASS

ERR_MORE_THAN_ONE_NAMECLASS

public static final String ERR_MORE_THAN_ONE_NAMECLASS

ERR_UNDECLARED_PREFIX

public static final String ERR_UNDECLARED_PREFIX

ERR_UNDEFINED_PATTERN

public static final String ERR_UNDEFINED_PATTERN

ERR_UNKNOWN_DATATYPE_VOCABULARY

public static final String ERR_UNKNOWN_DATATYPE_VOCABULARY

ERR_BAD_COMBINE

public static final String ERR_BAD_COMBINE

ERR_COMBINE_MISSING

public static final String ERR_COMBINE_MISSING

WRN_COMBINE_IGNORED

public static final String WRN_COMBINE_IGNORED

WRN_OBSOLETED_XMLSCHEMA_NAMSPACE

public static final String WRN_OBSOLETED_XMLSCHEMA_NAMSPACE

ERR_DUPLICATE_DEFINITION

public static final String ERR_DUPLICATE_DEFINITION

ERR_NONEXISTENT_PARENT_GRAMMAR

public static final String ERR_NONEXISTENT_PARENT_GRAMMAR

ERR_INTERLEAVED_STRING

public static final String ERR_INTERLEAVED_STRING

ERR_SEQUENCED_STRING

public static final String ERR_SEQUENCED_STRING

ERR_REPEATED_STRING

public static final String ERR_REPEATED_STRING
Constructor Detail

TREXBaseReader

public TREXBaseReader(GrammarReaderController controller,
                      javax.xml.parsers.SAXParserFactory parserFactory,
                      ExpressionPool pool,
                      TREXBaseReader.StateFactory stateFactory,
                      State rootState)
full constructor
Method Detail

getResult

public final TREXGrammar getResult()
obtains parsed grammar object only if parsing was successful.

getResultAsGrammar

public Grammar getResultAsGrammar()
Description copied from class: GrammarReader
gets the parsed AGM. Should any error happens, this method returns null. derived classes should implement type-safe getGrammar method, along with this method.
Overrides:
getResultAsGrammar in class GrammarReader

getTargetNamespace

public final String getTargetNamespace()

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.
Overrides:
createExpressionChildState in class GrammarReader
Following copied from class: com.sun.msv.reader.GrammarReader
Returns:
null if the start tag is an error.

wrapUp

public void wrapUp()
performs final wrap-up. This method is called from the RootState object, after the parsing is completed.

startElement

public void startElement(String a,
                         String b,
                         String c,
                         Attributes d)
                  throws SAXException
Overrides:
startElement in class XMLFilterImpl

endElement

public void endElement(String a,
                       String b,
                       String c)
                throws SAXException
Overrides:
endElement in class XMLFilterImpl