Class RELAXNGReader
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
com.sun.msv.reader.GrammarReader
com.sun.msv.reader.trex.TREXBaseReader
com.sun.msv.reader.trex.ng.RELAXNGReader
- All Implemented Interfaces:
IDContextProvider2, org.relaxng.datatype.ValidationContext, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
- Direct Known Subclasses:
RELAXNGCompReader
reads RELAX NG grammar from SAX2 and constructs abstract grammar model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprotected static classinformation necessary to correctly parse pattern definitions.static classcreates various State object, which in turn parses grammar.Nested classes/interfaces inherited from class GrammarReader
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RELAXNGReader.RefExpParseInfoInfo about the current ReferenceExp object which is being defined.private org.relaxng.datatype.DatatypeLibrarycurrently active datatype library.private org.relaxng.datatype.DatatypeLibraryFactoryDatatypeLibrary factory object.protected Stringthe namespace URI of the currently active datatype library.protected booleanFlag to indicate whether we saw <element> or not.private final LightStackprivate final LightStackstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate final MapMap from ReferenceExps to RefExpParseInfos.static final StringNamespace URI of RELAX NGprotected static org.iso_relax.verifier.SchemaSchema for schema of RELAX NG.protected final RestrictionCheckerContextual restriction checker.Fields 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
ConstructorsConstructorDescriptionRELAXNGReader(GrammarReaderController controller) easy-to-use constructor.RELAXNGReader(GrammarReaderController controller, SAXParserFactory parserFactory) easy-to-use constructor.RELAXNGReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXNGReader.StateFactory stateFactory, ExpressionPool pool) full constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckRunawayExpression(ReferenceExp node, Stack items, Set visitedExps) createExpressionChildState(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) voidvoidendElement(String a, String b, String c) org.relaxng.datatype.DatatypeLibraryorg.relaxng.datatype.DatatypeLibraryFactoryReturns the datatypeLibraryFactory.protected TREXGrammarprotected RELAXNGReader.RefExpParseInfoGets RefExpParseInfo object for the specified ReferenceExp.static org.iso_relax.verifier.Schemaprotected RELAXNGReader.StateFactoryprotected booleanchecks if given element is that of the grammar elements.protected StringlocalizeMessage(String propertyName, Object[] args) formats localized message with argumentsstatic TREXGrammarparse(String grammarURL, SAXParserFactory factory, GrammarReaderController controller) loads RELAX NG patternstatic TREXGrammarparse(InputSource grammar, SAXParserFactory factory, GrammarReaderController controller) loads RELAX NG patternorg.relaxng.datatype.DatatyperesolveDataType(String localName) obtains a named DataType object referenced by a local name.org.relaxng.datatype.DatatypeLibraryobtains the DataTypeLibrary that represents the specified namespace URI.resolveNamespacePrefix(String prefix) voidsetDatatypeLibraryFactory(org.relaxng.datatype.DatatypeLibraryFactory datatypeLibraryFactory) Sets the datatypeLibraryFactory.voidvoidstartElement(String a, String b, String c, Attributes d) voidwrapUp()performs final wrap-up.Methods inherited from class TREXBaseReader
getResult, getResultAsGrammar, getTargetNamespaceMethods 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, runBackPatchJob, setDeclaredLocationOf, setDocumentLocator, setLocator, splitQName, startPrefixMapping, switchSource, switchSource, switchSourceMethods inherited from class XMLFilterImpl
characters, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, unparsedEntityDecl, warning
-
Field Details
-
relaxNGSchema4Schema
protected static org.iso_relax.verifier.Schema relaxNGSchema4SchemaSchema for schema of RELAX NG. -
refExpParseInfos
Map from ReferenceExps to RefExpParseInfos. -
currentNamedPattern
Info about the current ReferenceExp object which is being defined. This field is maintained by DefineState.This field is set to null when there is an error, or the pattern being defined is being re-defined.
This is a part of the process of the recursive self reference error detection.
-
directRefernce
protected boolean directRefernceFlag to indicate whether we saw <element> or not. If we don't see any <element> between <define>/<start> and <ref>/<parentRef>, then that reference will go tocurrentNamedPattern.refs.This is a part of the process of the recursive self reference error detection.
-
RELAXNGNamespace
-
datatypeLibraryFactory
private org.relaxng.datatype.DatatypeLibraryFactory datatypeLibraryFactoryDatatypeLibrary factory object. -
restrictionChecker
Contextual restriction checker. -
datatypeLib
private org.relaxng.datatype.DatatypeLibrary datatypeLibcurrently active datatype library. This field is maintained by this class. In case of an error, this field may be set to null after issuing an error. So care should be taken not to report the same error again. -
datatypeLibURI
the namespace URI of the currently active datatype library. The empty string indicates the built-in datatype library. -
dtLibStack
-
dtLibURIStack
-
ERR_BAD_FACET
- See Also:
-
ERR_INVALID_PARAMETERS
- See Also:
-
ERR_BAD_DATA_VALUE
- See Also:
-
ERR_UNDEFINED_KEY
- See Also:
-
ERR_UNDEFINED_DATATYPE_1
- See Also:
-
ERR_INCONSISTENT_KEY_TYPE
- See Also:
-
ERR_INCONSISTENT_COMBINE
- See Also:
-
ERR_REDEFINING_UNDEFINED
- See Also:
-
ERR_UNKNOWN_DATATYPE_VOCABULARY_1
- See Also:
-
ERR_MULTIPLE_EXCEPT
- See Also:
-
ERR_NOT_ABSOLUTE_URI
- See Also:
-
ERR_INFOSET_URI_ATTRIBUTE
- See Also:
-
ERR_XMLNS_ATTRIBUTE
- See Also:
-
ERR_NAKED_INFINITE_ATTRIBUTE_NAMECLASS
- See Also:
-
-
Constructor Details
-
RELAXNGReader
easy-to-use constructor. -
RELAXNGReader
easy-to-use constructor. -
RELAXNGReader
public RELAXNGReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXNGReader.StateFactory stateFactory, ExpressionPool pool) full constructor
-
-
Method Details
-
parse
public static TREXGrammar parse(String grammarURL, SAXParserFactory factory, GrammarReaderController controller) loads RELAX NG pattern -
parse
public static TREXGrammar parse(InputSource grammar, SAXParserFactory factory, GrammarReaderController controller) loads RELAX NG pattern -
getRELAXNGSchema4Schema
public static org.iso_relax.verifier.Schema getRELAXNGSchema4Schema() -
localizeMessage
Description copied from class:GrammarReaderformats localized message with arguments- Overrides:
localizeMessagein classTREXBaseReader
-
getGrammar
-
getRefExpParseInfo
Gets RefExpParseInfo object for the specified ReferenceExp. -
isGrammarElement
Description copied from class:GrammarReaderchecks if given element is that of the grammar elements.- Specified by:
isGrammarElementin classGrammarReader
-
getDatatypeLibraryFactory
public org.relaxng.datatype.DatatypeLibraryFactory getDatatypeLibraryFactory()Returns the datatypeLibraryFactory. -
setDatatypeLibraryFactory
public void setDatatypeLibraryFactory(org.relaxng.datatype.DatatypeLibraryFactory datatypeLibraryFactory) Sets the datatypeLibraryFactory. -
getStateFactory
-
createNameClassChildState
- Overrides:
createNameClassChildStatein classTREXBaseReader
-
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.
-
resolveDataType
obtains a named DataType object referenced by a local name. -
resolveDataTypeLibrary
obtains the DataTypeLibrary that represents the specified namespace URI. If the specified URI is undefined, then this method issues an error to the user and must return a dummy datatype library. -
checkRunawayExpression
private void checkRunawayExpression(ReferenceExp node, Stack items, Set visitedExps) throws RELAXNGReader.AbortException - Throws:
RELAXNGReader.AbortException
-
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
-
getCurrentDatatypeLibrary
public org.relaxng.datatype.DatatypeLibrary getCurrentDatatypeLibrary() -
resolveNamespacePrefix
- Specified by:
resolveNamespacePrefixin interfaceorg.relaxng.datatype.ValidationContext- Overrides:
resolveNamespacePrefixin classGrammarReader
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classXMLFilterImpl- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classXMLFilterImpl- Throws:
SAXException
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classTREXBaseReader- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classTREXBaseReader- Throws:
SAXException
-