Package com.sun.msv.reader.trex.ng.comp
Class RELAXNGCompReader
- 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
-
- com.sun.msv.reader.trex.ng.comp.RELAXNGCompReader
-
- All Implemented Interfaces:
IDContextProvider2
,org.relaxng.datatype.ValidationContext
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.XMLFilter
,org.xml.sax.XMLReader
public class RELAXNGCompReader extends RELAXNGReader
reads RELAX NG grammar with DTD compatibility annotation and constructs abstract grammar model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RELAXNGCompReader.StateFactory
creates various State object, which in turn parses grammar.-
Nested classes/interfaces inherited from class com.sun.msv.reader.trex.ng.RELAXNGReader
RELAXNGReader.RefExpParseInfo
-
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 java.lang.String
AnnotationNamespace
Namespace URI of RELAX NG DTD compatibility annotationstatic java.lang.String
CERR_ANN_CHILD_ELEMENT
static java.lang.String
CERR_ANN_INVALID_ATTRIBUTE
static java.lang.String
CERR_ANN_MISPLACED
private java.util.Map
defaultedAttributes
private boolean
inAnnotation
private LightStack
lastRNGElement
The local name of the preceding RELAX NG element sibling.-
Fields inherited from class com.sun.msv.reader.trex.ng.RELAXNGReader
currentNamedPattern, datatypeLibURI, directRefernce, ERR_BAD_DATA_VALUE, ERR_BAD_FACET, ERR_INCONSISTENT_COMBINE, ERR_INCONSISTENT_KEY_TYPE, ERR_INFOSET_URI_ATTRIBUTE, ERR_INVALID_PARAMETERS, ERR_MULTIPLE_EXCEPT, ERR_NAKED_INFINITE_ATTRIBUTE_NAMECLASS, ERR_NOT_ABSOLUTE_URI, ERR_REDEFINING_UNDEFINED, ERR_UNDEFINED_DATATYPE_1, ERR_UNDEFINED_KEY, ERR_UNKNOWN_DATATYPE_VOCABULARY_1, ERR_XMLNS_ATTRIBUTE, RELAXNGNamespace, relaxNGSchema4Schema, restrictionChecker
-
Fields inherited from class com.sun.msv.reader.trex.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_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 RELAXNGCompReader(GrammarReaderController controller)
easy-to-use constructor.RELAXNGCompReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, ExpressionPool pool)
easy-to-use constructor.RELAXNGCompReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, RELAXNGCompReader.StateFactory stateFactory, ExpressionPool pool)
full constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDefaultValue(AttributeExp exp, java.lang.String value)
note that the specified expression is marked with the default value.void
endElement(java.lang.String uri, java.lang.String local, java.lang.String qname)
protected TREXGrammar
getGrammar()
protected java.lang.String
localizeMessage(java.lang.String propertyName, java.lang.Object[] args)
formats localized message with argumentsstatic TREXGrammar
parse(java.lang.String grammarURL, GrammarReaderController controller)
loads RELAX NG pattern.static TREXGrammar
parse(org.xml.sax.InputSource grammar, GrammarReaderController controller)
loads RELAX NG pattern.void
startElement(java.lang.String uri, java.lang.String local, java.lang.String qname, org.xml.sax.Attributes atts)
void
wrapUp()
performs final wrap-up.-
Methods inherited from class com.sun.msv.reader.trex.ng.RELAXNGReader
createExpressionChildState, createNameClassChildState, endDocument, getCurrentDatatypeLibrary, getDatatypeLibraryFactory, getRefExpParseInfo, getRELAXNGSchema4Schema, getStateFactory, isGrammarElement, parse, parse, resolveDataType, resolveDataTypeLibrary, resolveNamespacePrefix, setDatatypeLibraryFactory, startDocument
-
Methods inherited from class com.sun.msv.reader.trex.TREXBaseReader
getResult, getResultAsGrammar, getTargetNamespace
-
Methods inherited from class com.sun.msv.reader.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, switchSource
-
Methods inherited from class org.xml.sax.helpers.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 Detail
-
defaultedAttributes
private final java.util.Map defaultedAttributes
-
AnnotationNamespace
public static final java.lang.String AnnotationNamespace
Namespace URI of RELAX NG DTD compatibility annotation- See Also:
- Constant Field Values
-
lastRNGElement
private final LightStack lastRNGElement
The local name of the preceding RELAX NG element sibling.
-
inAnnotation
private boolean inAnnotation
-
CERR_ANN_CHILD_ELEMENT
public static final java.lang.String CERR_ANN_CHILD_ELEMENT
- See Also:
- Constant Field Values
-
CERR_ANN_MISPLACED
public static final java.lang.String CERR_ANN_MISPLACED
- See Also:
- Constant Field Values
-
CERR_ANN_INVALID_ATTRIBUTE
public static final java.lang.String CERR_ANN_INVALID_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RELAXNGCompReader
public RELAXNGCompReader(GrammarReaderController controller)
easy-to-use constructor.
-
RELAXNGCompReader
public RELAXNGCompReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, ExpressionPool pool)
easy-to-use constructor.
-
RELAXNGCompReader
public RELAXNGCompReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, RELAXNGCompReader.StateFactory stateFactory, ExpressionPool pool)
full constructor
-
-
Method Detail
-
parse
public static TREXGrammar parse(java.lang.String grammarURL, GrammarReaderController controller)
loads RELAX NG pattern.- Returns:
- it always returns
RELAXNGGrammar
, but due to the restriction imposed by Java language, I cannot change the signature of this method.
-
parse
public static TREXGrammar parse(org.xml.sax.InputSource grammar, GrammarReaderController controller)
loads RELAX NG pattern.- Returns:
- it always returns
RELAXNGGrammar
, but due to the restriction imposed by Java language, I cannot change the signature of this method.
-
addDefaultValue
protected final void addDefaultValue(AttributeExp exp, java.lang.String value)
note that the specified expression is marked with the default value. this method is called when a:defaultValue is found.
-
getGrammar
protected TREXGrammar getGrammar()
- Overrides:
getGrammar
in classRELAXNGReader
-
localizeMessage
protected java.lang.String localizeMessage(java.lang.String propertyName, java.lang.Object[] args)
Description copied from class:GrammarReader
formats localized message with arguments- Overrides:
localizeMessage
in classRELAXNGReader
-
wrapUp
public void wrapUp()
Description copied from class:TREXBaseReader
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.
- Overrides:
wrapUp
in classRELAXNGReader
-
startElement
public void startElement(java.lang.String uri, java.lang.String local, java.lang.String qname, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classRELAXNGReader
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String local, java.lang.String qname) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classRELAXNGReader
- Throws:
org.xml.sax.SAXException
-
-