public class RELAXCoreReader extends RELAXReader implements XSDatatypeResolver
Modifier and Type | Class and Description |
---|---|
static class |
RELAXCoreReader.StateFactory |
GrammarReader.BackPatch, GrammarReader.BackwardReferenceMap, GrammarReader.ChainPrefixResolver, GrammarReader.PrefixResolver
Modifier and Type | Field and Description |
---|---|
protected ReferenceContainer |
combinedAttPools
contains all expressions that are going to be combined.
|
static java.lang.String |
ERR_EXPROTED_HEDGERULE_CONSTRAINT |
static java.lang.String |
ERR_ID_ABUSE |
static java.lang.String |
ERR_ID_ABUSE_1 |
static java.lang.String |
ERR_INCONSISTENT_TARGET_NAMESPACE |
static java.lang.String |
ERR_LABEL_COLLISION |
static java.lang.String |
ERR_MISSING_TARGET_NAMESPACE |
static java.lang.String |
ERR_MORE_THAN_ONE_INLINE_TAG |
static java.lang.String |
ERR_MULTIPLE_ATTPOOL_DECLARATIONS |
static java.lang.String |
ERR_MULTIPLE_ATTRIBUTE_CONSTRAINT |
static java.lang.String |
ERR_MULTIPLE_TAG_DECLARATIONS |
static java.lang.String |
ERR_NAMESPACE_NOT_SUPPROTED |
static java.lang.String |
ERR_ROLE_COLLISION |
static java.lang.String |
ERR_UNDEFINED_ATTPOOL |
static java.lang.String |
ERR_UNDEFINED_ELEMENTRULE |
static java.lang.String |
ERR_UNDEFINED_HEDGERULE |
static java.lang.String |
ERR_UNDEFINED_TAG |
protected RELAXModule |
module
RELAX module object being under construction.
|
protected static org.iso_relax.verifier.Schema |
relaxCoreSchema4Schema
Schema for schema of RELAX Core.
|
private java.util.Map |
userDefinedTypes
User-defined datatypes (from type name to XSDatatypeExp object.
|
static java.lang.String |
WRN_ILLEGAL_RELAXCORE_VERSION |
static java.lang.String |
WRN_NO_EXPROTED_LABEL |
ERR_ILLEGAL_OCCURS, ERR_MISPLACED_OCCURS, RELAXCoreNamespace, sfactory
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 and Description |
---|
RELAXCoreReader(GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory parserFactory,
ExpressionPool pool) |
RELAXCoreReader(GrammarReaderController controller,
javax.xml.parsers.SAXParserFactory parserFactory,
RELAXCoreReader.StateFactory stateFactory,
ExpressionPool pool,
java.lang.String expectedTargetNamespace)
full constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserDefinedType(XSDatatypeExp exp) |
protected boolean |
canHaveOccurs(ExpressionState state)
returns true if the given state can have "occurs" attribute.
|
private Expression |
choiceOfExported(ReferenceContainer con) |
State |
createExpressionChildState(State parent,
StartTagInfo tag)
this method must be implemented by the derived class to create
language-default expresion state.
|
private void |
detectCollision(ReferenceContainer col1,
ReferenceContainer col2,
java.lang.String errMsg) |
private void |
detectDoubleAttributeConstraints(RELAXModule module)
detect two AttributeExps that share the same target name.
|
static org.iso_relax.verifier.Schema |
getRELAXCoreSchema4Schema() |
RELAXModule |
getResult()
obtains parsed grammar object only if parsing was successful.
|
Grammar |
getResultAsGrammar()
gets the parsed AGM.
|
protected RELAXCoreReader.StateFactory |
getStateFactory() |
protected boolean |
isGrammarElement(StartTagInfo tag)
checks if given element is that of the grammar elements.
|
protected java.lang.String |
localizeMessage(java.lang.String propertyName,
java.lang.Object[] args)
formats localized message with arguments
|
static RELAXModule |
parse(org.xml.sax.InputSource module,
javax.xml.parsers.SAXParserFactory factory,
GrammarReaderController controller,
ExpressionPool pool)
loads RELAX module
|
static RELAXModule |
parse(java.lang.String moduleURL,
javax.xml.parsers.SAXParserFactory factory,
GrammarReaderController controller,
ExpressionPool pool)
loads RELAX module
|
protected Expression |
resolveAttPoolRef(java.lang.String namespace,
java.lang.String role) |
protected Expression |
resolveElementRef(java.lang.String namespace,
java.lang.String label)
obtains an Expression specified by given (namespace,label) pair.
|
protected Expression |
resolveHedgeRef(java.lang.String namespace,
java.lang.String label)
obtains an Expression specified by given (namespace,label) pair.
|
XSDatatypeExp |
resolveXSDatatype(java.lang.String typeName)
gets DataType object from type name.
|
protected void |
wrapUp() |
canHaveOccurs, createFacetState, getPool, interceptExpression
_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, switchSource
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, warning
protected static org.iso_relax.verifier.Schema relaxCoreSchema4Schema
protected RELAXModule module
protected final ReferenceContainer combinedAttPools
private final java.util.Map userDefinedTypes
public static final java.lang.String ERR_NAMESPACE_NOT_SUPPROTED
public static final java.lang.String ERR_INCONSISTENT_TARGET_NAMESPACE
public static final java.lang.String ERR_MISSING_TARGET_NAMESPACE
public static final java.lang.String ERR_MULTIPLE_TAG_DECLARATIONS
public static final java.lang.String ERR_MORE_THAN_ONE_INLINE_TAG
public static final java.lang.String ERR_MULTIPLE_ATTPOOL_DECLARATIONS
public static final java.lang.String ERR_UNDEFINED_ELEMENTRULE
public static final java.lang.String ERR_UNDEFINED_HEDGERULE
public static final java.lang.String ERR_UNDEFINED_TAG
public static final java.lang.String ERR_UNDEFINED_ATTPOOL
public static final java.lang.String ERR_LABEL_COLLISION
public static final java.lang.String ERR_ROLE_COLLISION
public static final java.lang.String WRN_NO_EXPROTED_LABEL
public static final java.lang.String ERR_EXPROTED_HEDGERULE_CONSTRAINT
public static final java.lang.String ERR_MULTIPLE_ATTRIBUTE_CONSTRAINT
public static final java.lang.String ERR_ID_ABUSE
public static final java.lang.String ERR_ID_ABUSE_1
public static final java.lang.String WRN_ILLEGAL_RELAXCORE_VERSION
public RELAXCoreReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, ExpressionPool pool)
public RELAXCoreReader(GrammarReaderController controller, javax.xml.parsers.SAXParserFactory parserFactory, RELAXCoreReader.StateFactory stateFactory, ExpressionPool pool, java.lang.String expectedTargetNamespace)
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.public static RELAXModule parse(java.lang.String moduleURL, javax.xml.parsers.SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool)
public static RELAXModule parse(org.xml.sax.InputSource module, javax.xml.parsers.SAXParserFactory factory, GrammarReaderController controller, ExpressionPool pool)
public static org.iso_relax.verifier.Schema getRELAXCoreSchema4Schema()
public final RELAXModule getResult()
public final Grammar getResultAsGrammar()
GrammarReader
getResultAsGrammar
in class GrammarReader
protected boolean isGrammarElement(StartTagInfo tag)
GrammarReader
isGrammarElement
in class GrammarReader
public final void addUserDefinedType(XSDatatypeExp exp)
public XSDatatypeExp resolveXSDatatype(java.lang.String typeName)
resolveXSDatatype
in interface XSDatatypeResolver
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.protected final RELAXCoreReader.StateFactory getStateFactory()
public State createExpressionChildState(State parent, StartTagInfo tag)
GrammarReader
createExpressionChildState
in class RELAXReader
protected boolean canHaveOccurs(ExpressionState state)
protected Expression resolveElementRef(java.lang.String namespace, java.lang.String label)
RELAXReader
resolveElementRef
in class RELAXReader
protected Expression resolveHedgeRef(java.lang.String namespace, java.lang.String label)
RELAXReader
resolveHedgeRef
in class RELAXReader
protected Expression resolveAttPoolRef(java.lang.String namespace, java.lang.String role)
protected void wrapUp()
private Expression choiceOfExported(ReferenceContainer con)
private void detectDoubleAttributeConstraints(RELAXModule module)
DblAttrConstraintChecker
for details.private void detectCollision(ReferenceContainer col1, ReferenceContainer col2, java.lang.String errMsg)
protected java.lang.String localizeMessage(java.lang.String propertyName, java.lang.Object[] args)
GrammarReader
localizeMessage
in class RELAXReader