Package 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:
IDContextProvider2,org.relaxng.datatype.ValidationContext,ContentHandler,DTDHandler,EntityResolver,ErrorHandler,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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTREXBaseReader.StateFactorycreates 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
Fields Modifier and Type Field Description static StringERR_BAD_COMBINEstatic StringERR_COMBINE_MISSINGstatic StringERR_DUPLICATE_DEFINITIONstatic StringERR_INTERLEAVED_ANYSTRINGstatic StringERR_INTERLEAVED_STRINGstatic StringERR_MISSING_CHILD_NAMECLASSstatic StringERR_MORE_THAN_ONE_NAMECLASSstatic StringERR_NONEXISTENT_PARENT_GRAMMARstatic StringERR_REPEATED_STRINGstatic StringERR_SEQUENCED_STRINGstatic StringERR_UNDECLARED_PREFIXstatic StringERR_UNDEFINED_PATTERNstatic StringERR_UNKNOWN_DATATYPE_VOCABULARYprotected TREXGrammargrammargrammar object currently being loaded.TREXBaseReader.StateFactorysfactoryprotected StringtargetNamespacetarget namespace: currently active 'ns' attributestatic StringWRN_COMBINE_IGNOREDstatic StringWRN_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_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
Constructors Constructor Description TREXBaseReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool, TREXBaseReader.StateFactory stateFactory, State rootState)full constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatecreateExpressionChildState(State parent, StartTagInfo tag)this method must be implemented by the derived class to create language-default expresion state.protected StatecreateNameClassChildState(State parent, StartTagInfo tag)voidendElement(String a, String b, String c)TREXGrammargetResult()obtains parsed grammar object only if parsing was successful.GrammargetResultAsGrammar()gets the parsed AGM.StringgetTargetNamespace()protected StringlocalizeMessage(String propertyName, Object[] args)formats localized message with argumentsvoidstartElement(String a, String b, String c, Attributes d)voidwrapUp()performs final wrap-up.-
Methods inherited from class com.sun.msv.reader.GrammarReader
_parse, addBackPatchJob, addBackPatchJob, combineURI, combineURL, createParserFactory, detectUndefinedOnes, endPrefixMapping, getBackwardCompatibleType, getBaseUri, getCurrentState, getDeclaredLocationOf, getLocator, inputSourceFromLSInput, interceptExpression, 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, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
grammar
protected TREXGrammar grammar
grammar object currently being loaded.
-
targetNamespace
protected String targetNamespace
target namespace: currently active 'ns' attribute
-
sfactory
public final TREXBaseReader.StateFactory sfactory
-
ERR_MISSING_CHILD_NAMECLASS
public static final String ERR_MISSING_CHILD_NAMECLASS
- See Also:
- Constant Field Values
-
ERR_MORE_THAN_ONE_NAMECLASS
public static final String ERR_MORE_THAN_ONE_NAMECLASS
- See Also:
- Constant Field Values
-
ERR_UNDECLARED_PREFIX
public static final String ERR_UNDECLARED_PREFIX
- See Also:
- Constant Field Values
-
ERR_UNDEFINED_PATTERN
public static final String ERR_UNDEFINED_PATTERN
- See Also:
- Constant Field Values
-
ERR_UNKNOWN_DATATYPE_VOCABULARY
public static final String ERR_UNKNOWN_DATATYPE_VOCABULARY
- See Also:
- Constant Field Values
-
ERR_BAD_COMBINE
public static final String ERR_BAD_COMBINE
- See Also:
- Constant Field Values
-
ERR_COMBINE_MISSING
public static final String ERR_COMBINE_MISSING
- See Also:
- Constant Field Values
-
WRN_COMBINE_IGNORED
public static final String WRN_COMBINE_IGNORED
- See Also:
- Constant Field Values
-
WRN_OBSOLETED_XMLSCHEMA_NAMSPACE
public static final String WRN_OBSOLETED_XMLSCHEMA_NAMSPACE
- See Also:
- Constant Field Values
-
ERR_DUPLICATE_DEFINITION
public static final String ERR_DUPLICATE_DEFINITION
- See Also:
- Constant Field Values
-
ERR_NONEXISTENT_PARENT_GRAMMAR
public static final String ERR_NONEXISTENT_PARENT_GRAMMAR
- See Also:
- Constant Field Values
-
ERR_INTERLEAVED_STRING
public static final String ERR_INTERLEAVED_STRING
- See Also:
- Constant Field Values
-
ERR_SEQUENCED_STRING
public static final String ERR_SEQUENCED_STRING
- See Also:
- Constant Field Values
-
ERR_REPEATED_STRING
public static final String ERR_REPEATED_STRING
- See Also:
- Constant Field Values
-
ERR_INTERLEAVED_ANYSTRING
public static final String ERR_INTERLEAVED_ANYSTRING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TREXBaseReader
public TREXBaseReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool, TREXBaseReader.StateFactory stateFactory, State rootState)
full constructor
-
-
Method Detail
-
localizeMessage
protected String localizeMessage(String propertyName, Object[] args)
Description copied from class:GrammarReaderformats localized message with arguments- Specified by:
localizeMessagein classGrammarReader
-
getResult
public final TREXGrammar getResult()
obtains parsed grammar object only if parsing was successful.
-
getResultAsGrammar
public Grammar getResultAsGrammar()
Description copied from class:GrammarReadergets the parsed AGM. Should any error happens, this method should returns null. derived classes should implement type-safe getGrammar method, along with this method.- Specified by:
getResultAsGrammarin classGrammarReader
-
getTargetNamespace
public final String getTargetNamespace()
-
createNameClassChildState
protected State createNameClassChildState(State parent, StartTagInfo tag)
-
createExpressionChildState
public State createExpressionChildState(State parent, StartTagInfo tag)
Description copied from class:GrammarReaderthis method must be implemented by the derived class to create language-default expresion state.- Specified by:
createExpressionChildStatein classGrammarReader- 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.This method has to be called after the run-away expression check is done.
-
startElement
public void startElement(String a, String b, String c, Attributes d) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classXMLFilterImpl- Throws:
SAXException
-
endElement
public void endElement(String a, String b, String c) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classXMLFilterImpl- Throws:
SAXException
-
-