Package com.sun.msv.reader.relax.core
Class RELAXCoreReader
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
com.sun.msv.reader.GrammarReader
com.sun.msv.reader.relax.RELAXReader
com.sun.msv.reader.relax.core.RELAXCoreReader
- All Implemented Interfaces:
IDContextProvider2,XSDatatypeResolver,org.relaxng.datatype.ValidationContext,ContentHandler,DTDHandler,EntityResolver,ErrorHandler,XMLFilter,XMLReader
- Direct Known Subclasses:
RELAXCoreIslandSchemaReader
reads RELAX module (classic RELAX module; no namespace extension)
by SAX2 and constructs abstract grammar model.
This class does not recognize extensions introduced by RELAX Namespace
(like anyOtherElement, or <ref label="..." namespace="..." />.
- Author:
- Kohsuke KAWAGUCHI
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.sun.msv.reader.GrammarReader
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReferenceContainercontains all expressions that are going to be combined.static 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 Stringstatic final Stringstatic final Stringprotected RELAXModuleRELAX module object being under construction.protected static org.iso_relax.verifier.SchemaSchema for schema of RELAX Core.static final Stringstatic final StringFields inherited from class com.sun.msv.reader.relax.RELAXReader
ERR_ILLEGAL_OCCURS, ERR_MISPLACED_OCCURS, RELAXCoreNamespace, sfactoryFields 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
ConstructorsConstructorDescriptionRELAXCoreReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool) RELAXCoreReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXCoreReader.StateFactory stateFactory, ExpressionPool pool, String expectedTargetNamespace) full constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidprotected booleancanHaveOccurs(ExpressionState state) returns true if the given state can have "occurs" attribute.createExpressionChildState(State parent, StartTagInfo tag) this method must be implemented by the derived class to create language-default expresion state.static org.iso_relax.verifier.Schemafinal RELAXModuleobtains parsed grammar object only if parsing was successful.final Grammargets the parsed AGM.protected final RELAXCoreReader.StateFactoryprotected booleanchecks if given element is that of the grammar elements.protected StringlocalizeMessage(String propertyName, Object[] args) formats localized message with argumentsstatic RELAXModuleparse(String moduleURL, SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool) loads RELAX modulestatic RELAXModuleparse(InputSource module, SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool) loads RELAX moduleprotected ExpressionresolveAttPoolRef(String namespace, String role) protected ExpressionresolveElementRef(String namespace, String label) obtains an Expression specified by given (namespace,label) pair.protected ExpressionresolveHedgeRef(String namespace, String label) obtains an Expression specified by given (namespace,label) pair.resolveXSDatatype(String typeName) gets DataType object from type name.protected voidwrapUp()Methods inherited from class com.sun.msv.reader.relax.RELAXReader
canHaveOccurs, createFacetState, getPool, interceptExpressionMethods inherited from class com.sun.msv.reader.GrammarReader
_parse, addBackPatchJob, addBackPatchJob, combineURI, combineURL, createParserFactory, detectUndefinedOnes, endPrefixMapping, getBackwardCompatibleType, getBaseUri, getCurrentState, getDeclaredLocationOf, getLocator, inputSourceFromLSInput, 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 org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, endElement, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
relaxCoreSchema4Schema
protected static org.iso_relax.verifier.Schema relaxCoreSchema4SchemaSchema for schema of RELAX Core. Unless overrided, this schema for schema will be used to parse a RELAX Core schema. To override, call the full constructor of this class and change the parameter. -
module
RELAX module object being under construction. object is created when target namespace is identified. -
combinedAttPools
contains all expressions that are going to be combined. ReferenceExp is used to wrap an expression to provide location information. (attPool element with combine attribute). -
ERR_NAMESPACE_NOT_SUPPROTED
- See Also:
-
ERR_INCONSISTENT_TARGET_NAMESPACE
- See Also:
-
ERR_MISSING_TARGET_NAMESPACE
- See Also:
-
ERR_MULTIPLE_TAG_DECLARATIONS
- See Also:
-
ERR_MORE_THAN_ONE_INLINE_TAG
- See Also:
-
ERR_MULTIPLE_ATTPOOL_DECLARATIONS
- See Also:
-
ERR_UNDEFINED_ELEMENTRULE
- See Also:
-
ERR_UNDEFINED_HEDGERULE
- See Also:
-
ERR_UNDEFINED_TAG
- See Also:
-
ERR_UNDEFINED_ATTPOOL
- See Also:
-
ERR_LABEL_COLLISION
- See Also:
-
ERR_ROLE_COLLISION
- See Also:
-
WRN_NO_EXPROTED_LABEL
- See Also:
-
ERR_EXPROTED_HEDGERULE_CONSTRAINT
- See Also:
-
ERR_MULTIPLE_ATTRIBUTE_CONSTRAINT
- See Also:
-
ERR_ID_ABUSE
- See Also:
-
ERR_ID_ABUSE_1
- See Also:
-
WRN_ILLEGAL_RELAXCORE_VERSION
- See Also:
-
-
Constructor Details
-
RELAXCoreReader
public RELAXCoreReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool) -
RELAXCoreReader
public RELAXCoreReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXCoreReader.StateFactory stateFactory, ExpressionPool pool, String expectedTargetNamespace) full constructor.- Parameters:
stateFactory- this object creates all parsing state object. Parsing behavior can be modified by changing this object.expectedTargetNamespace- expected value of 'targetNamespace' attribute. If this value is null, then the module must have 'targetNamepsace' attribute. If this value is non-null and module doesn't have targetNamespace attribute, then expectedTargetNamespace is used as the module's target namespace (chameleon effect). If expectedNamespace differs from the module's targetNamespace attribute, then an error will be issued.
-
-
Method Details
-
parse
public static RELAXModule parse(String moduleURL, SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool) loads RELAX module -
parse
public static RELAXModule parse(InputSource module, SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool) loads RELAX module -
getRELAXCoreSchema4Schema
public static org.iso_relax.verifier.Schema getRELAXCoreSchema4Schema() -
getResult
obtains parsed grammar object only if parsing was successful. -
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
-
isGrammarElement
Description copied from class:GrammarReaderchecks if given element is that of the grammar elements.- Specified by:
isGrammarElementin classGrammarReader
-
addUserDefinedType
-
resolveXSDatatype
gets DataType object from type name. If undefined type name is specified, this method is responsible to report an error, and recovers.- Specified by:
resolveXSDatatypein interfaceXSDatatypeResolver- Parameters:
typeName- 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.
-
getStateFactory
-
createExpressionChildState
Description copied from class:GrammarReaderthis method must be implemented by the derived class to create language-default expresion state.- Overrides:
createExpressionChildStatein classRELAXReader- Returns:
- null if the start tag is an error.
-
canHaveOccurs
returns true if the given state can have "occurs" attribute. -
resolveElementRef
Description copied from class:RELAXReaderobtains an Expression specified by given (namespace,label) pair. this method is called to parse <ref label="..." /> element.- Specified by:
resolveElementRefin classRELAXReader
-
resolveHedgeRef
Description copied from class:RELAXReaderobtains an Expression specified by given (namespace,label) pair. this method is called to parse <hedgeRef label="..." /> element.- Specified by:
resolveHedgeRefin classRELAXReader
-
resolveAttPoolRef
-
wrapUp
protected void wrapUp() -
localizeMessage
Description copied from class:GrammarReaderformats localized message with arguments- Overrides:
localizeMessagein classRELAXReader
-