Class TREXGrammarReader
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
com.sun.msv.reader.GrammarReader
com.sun.msv.reader.trex.TREXBaseReader
com.sun.msv.reader.trex.classic.TREXGrammarReader
- All Implemented Interfaces:
IDContextProvider2, XSDatatypeResolver, org.relaxng.datatype.ValidationContext, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
reads TREX grammar from SAX2 and constructs abstract grammar model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classcreates various State object, which in turn parses grammar.private static classDummy DataTypeVocabulary for better error recovery.Nested classes/interfaces inherited from class GrammarReader
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringTREX allows either (1) the predefined namespace for TREX or (2) default namespace "" as its namespace.private booleanstatic final StringNamespace URI of TREXFields inherited from class TREXBaseReader
ERR_BAD_COMBINE, ERR_COMBINE_MISSING, ERR_DUPLICATE_DEFINITION, ERR_INTERLEAVED_ANYSTRING, ERR_INTERLEAVED_STRING, ERR_MISSING_CHILD_NAMECLASS, ERR_MORE_THAN_ONE_NAMECLASS, ERR_NONEXISTENT_PARENT_GRAMMAR, ERR_REPEATED_STRING, ERR_SEQUENCED_STRING, ERR_UNDECLARED_PREFIX, ERR_UNDEFINED_PATTERN, ERR_UNKNOWN_DATATYPE_VOCABULARY, grammar, sfactory, targetNamespace, WRN_COMBINE_IGNORED, WRN_OBSOLETED_XMLSCHEMA_NAMSPACEFields inherited from class 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
ConstructorsConstructorDescriptionTREXGrammarReader(GrammarReaderController controller) easy-to-use constructor.TREXGrammarReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool) easy-to-use constructor.TREXGrammarReader(GrammarReaderController controller, SAXParserFactory parserFactory, TREXGrammarReader.StateFactory stateFactory, ExpressionPool pool) full constructor -
Method Summary
Modifier and TypeMethodDescriptioncreateExpressionChildState(State parent, StartTagInfo tag) this method must be implemented by the derived class to create language-default expresion state.protected TREXGrammarprotected TREXGrammarReader.StateFactoryprotected booleanchecks if given element is that of the grammar elements.protected StringlocalizeMessage(String propertyName, Object[] args) formats localized message with argumentsprivate StringmapNamespace(String namespace) maps obsoleted XML Schema namespace to the current one.static TREXGrammarparse(String grammarURL, SAXParserFactory factory, GrammarReaderController controller) loads TREX patternstatic TREXGrammarparse(InputSource grammar, SAXParserFactory factory, GrammarReaderController controller) loads TREX patternorg.relaxng.datatype.DatatyperesolveDatatype(String qName) obtains a named DataType object referenced by a QName.resolveXSDatatype(String qName) voidwrapUp()performs final wrap-up.Methods inherited from class TREXBaseReader
createNameClassChildState, endElement, getResult, getResultAsGrammar, getTargetNamespace, startElementMethods inherited from class GrammarReader
_parse, addBackPatchJob, addBackPatchJob, combineURI, combineURL, createParserFactory, detectUndefinedOnes, endPrefixMapping, getBackwardCompatibleType, getBaseUri, getCurrentState, getDeclaredLocationOf, getLocator, inputSourceFromLSInput, interceptExpression, 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, switchSourceMethods inherited from class 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 Details
-
currentGrammarURI
TREX allows either (1) the predefined namespace for TREX or (2) default namespace "" as its namespace. This variable holds which namespace is currently in use. -
TREXNamespace
-
issueObsoletedXMLSchemaNamespace
private boolean issueObsoletedXMLSchemaNamespace
-
-
Constructor Details
-
TREXGrammarReader
easy-to-use constructor. -
TREXGrammarReader
public TREXGrammarReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool) easy-to-use constructor. -
TREXGrammarReader
public TREXGrammarReader(GrammarReaderController controller, SAXParserFactory parserFactory, TREXGrammarReader.StateFactory stateFactory, ExpressionPool pool) full constructor
-
-
Method Details
-
parse
public static TREXGrammar parse(String grammarURL, SAXParserFactory factory, GrammarReaderController controller) loads TREX pattern -
parse
public static TREXGrammar parse(InputSource grammar, SAXParserFactory factory, GrammarReaderController controller) loads TREX pattern -
localizeMessage
Description copied from class:GrammarReaderformats localized message with arguments- Overrides:
localizeMessagein classTREXBaseReader
-
getGrammar
-
isGrammarElement
Description copied from class:GrammarReaderchecks if given element is that of the grammar elements.- Specified by:
isGrammarElementin classGrammarReader
-
getStateFactory
-
mapNamespace
-
createExpressionChildState
Description copied from class:GrammarReaderthis method must be implemented by the derived class to create language-default expresion state.- Overrides:
createExpressionChildStatein classTREXBaseReader- Returns:
- null if the start tag is an error.
-
resolveXSDatatype
- Specified by:
resolveXSDatatypein interfaceXSDatatypeResolver- Parameters:
qName- The type of this value varies in the schema language. In XML Schema, for example, in which QNames are used to designate datatypes, this parameter will be QName. In RELAX Core, in which the same syntax is used but NCName is used to designate datatypes. So this parameter will be NCName.- Returns:
- A non-null valid object. An error should be reported and recovered by the callee.
-
resolveDatatype
obtains a named DataType object referenced by a QName. -
wrapUp
public void wrapUp()Description copied from class:TREXBaseReaderperforms 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.
- Overrides:
wrapUpin classTREXBaseReader
-