Class XMLSchemaReader

    • Field Detail

      • xmlSchema4XmlSchema

        protected static org.iso_relax.verifier.Schema xmlSchema4XmlSchema
        Schema for schema of W3C XML Schema.
      • xsiSchemaLocationExp

        public final ReferenceExp xsiSchemaLocationExp
        content model that matches to optional xsi:schemaLocation or xsi:noNamespaceSchemaLocation.
      • complexUrType

        public final ComplexTypeExp complexUrType
        expression that matches to "ur-type" when used as a complex type.
      • attributeFormDefault

        protected String attributeFormDefault
        value of the "attributeFormDefault" attribute.
      • elementFormDefault

        protected String elementFormDefault
        value of the "elementFormDefault" attribute.
      • finalDefault

        protected String finalDefault
        value of the "finalDefault" attribute. Set to null if the attribute was not specified.
      • blockDefault

        protected String blockDefault
        value of the "blockDefault" attribute. Set to null if the attribute was not specified.
      • grammar

        protected final XMLSchemaGrammar grammar
        grammar object which is being under construction.
      • xsdSchema

        protected final XMLSchemaSchema xsdSchema
        XMLSchemaSchema object that has XMLSchemaNamespace as its target namespace.
      • parsedFiles

        public final Map<String,​Set<String>> parsedFiles
        tables that store all SystemIds that we've read. map from target namespace URI to set of system ids. This field is used to prevent double inclusion. Strictly speaking, comparision based on system id is not enough. The spec calls for "the necessity of establishing identity component by component" (section 4.2.1, last note).
      • XMLSchemaNamespace

        public static final String XMLSchemaNamespace
        namespace URI of XML Schema declarations.
        See Also:
        Constant Field Values
      • chameleonTargetNamespace

        protected String chameleonTargetNamespace
        The intended target namespace of the chameleon schema.

        When parsing a chameleon schema (inclusion of a schema without the targetNamespace attribute), this field is set to the target namespace of the callee, so that any reference occured in the chameleon schema is treated correctly.

        This field must be set to null in other cases. In that case, QName resolution is handled just normally.

        This field is maintained by SchemaIncludedState.

      • doDuplicateDefinitionCheck

        public boolean doDuplicateDefinitionCheck
        a flag that indicates State objects should check duplicate definitions. This flag is set to false when in <redefine>. Otherwise this flag is true.
      • ERR_UNDEFINED_COMPLEX_OR_SIMPLE_TYPE

        public static final String ERR_UNDEFINED_COMPLEX_OR_SIMPLE_TYPE
        See Also:
        Constant Field Values
      • ERR_UNDEFINED_OR_FORWARD_REFERENCED_TYPE

        public static final String ERR_UNDEFINED_OR_FORWARD_REFERENCED_TYPE
        See Also:
        Constant Field Values
      • ERR_DUPLICATE_COMPLEXTYPE_DEFINITION

        public static final String ERR_DUPLICATE_COMPLEXTYPE_DEFINITION
        See Also:
        Constant Field Values
      • ERR_DUPLICATE_ATTRIBUTE_GROUP_DEFINITION

        public static final String ERR_DUPLICATE_ATTRIBUTE_GROUP_DEFINITION
        See Also:
        Constant Field Values
      • ERR_DUPLICATE_IDENTITY_CONSTRAINT_DEFINITION

        public static final String ERR_DUPLICATE_IDENTITY_CONSTRAINT_DEFINITION
        See Also:
        Constant Field Values
      • ERR_INVALID_BASETYPE_FOR_SIMPLECONTENT

        public static final String ERR_INVALID_BASETYPE_FOR_SIMPLECONTENT
        See Also:
        Constant Field Values
      • ERR_UNRELATED_TYPES_IN_SUBSTITUTIONGROUP

        public static final String ERR_UNRELATED_TYPES_IN_SUBSTITUTIONGROUP
        See Also:
        Constant Field Values
    • Method Detail

      • getXmlSchemaForXmlSchema

        public static org.iso_relax.verifier.Schema getXmlSchemaForXmlSchema()
      • getResultAsGrammar

        public Grammar getResultAsGrammar()
        Description copied from class: GrammarReader
        gets 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:
        getResultAsGrammar in class GrammarReader
      • getOrCreateSchema

        public XMLSchemaSchema getOrCreateSchema​(String namespaceURI)
        gets a reference to XMLSchemaGrammar object whose target namespace is the specified one. If there is no such object, this method creates a new instance and returns it.
      • createModelGroupState

        public State createModelGroupState​(State parent,
                                           StartTagInfo tag)
        creates a state object that parses "all"/"group ref"/"choice" and "sequence".
      • createAttributeState

        public State createAttributeState​(State parent,
                                          StartTagInfo tag)
        creates a state object that parses "attribute","attributeGroup ref", and "anyAttribute".
      • markSchemaAsDefined

        public final void markSchemaAsDefined​(XMLSchemaSchema schema)
      • isSchemaDefined

        public final boolean isSchemaDefined​(XMLSchemaSchema schema)
      • resolveNamespaceOfAttributeDecl

        protected String resolveNamespaceOfAttributeDecl​(String formValue)
      • resolveNamespaceOfElementDecl

        protected String resolveNamespaceOfElementDecl​(String formValue)
      • resolveBuiltinDataType

        public XSDatatype resolveBuiltinDataType​(String typeLocalName)
        resolves built-in datatypes (URI: http://www.w3.org/2001/XMLSchema)
        Returns:
        null if the type is not defined.
      • resolveBuiltinSimpleType

        public SimpleTypeExp resolveBuiltinSimpleType​(String typeLocalName)
        Gets a built-in datatype as SimpleTypeExp.
        Returns:
        null if the type is not defined.
      • isSchemaNamespace

        public boolean isSchemaNamespace​(String ns)
      • resolveXSDatatype

        public XSDatatypeExp resolveXSDatatype​(String typeQName)
        Resolves a simple type name into the corresponding XSDatatypeExp object.
        Specified by:
        resolveXSDatatype in interface XSDatatypeResolver
        Parameters:
        typeQName - 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.
      • splitQName

        public String[] splitQName​(String qName)
        Resolves a QName into a pair of (namespace URI,local name).

        When we are parsing a "chameleon schema", any reference to the default empty namespace("") has to be treated as a reference to the intended target namespace.

        Overrides:
        splitQName in class GrammarReader
      • interceptExpression

        protected Expression interceptExpression​(State state,
                                                 Expression exp)
        Description copied from class: GrammarReader
        intercepts an expression made by ExpressionState before it is passed to the parent state. derived class can perform further wrap-up before it is received by the parent. This mechanism is used by RELAXReader to handle occurs attribute.
        Overrides:
        interceptExpression in class GrammarReader
      • processOccurs

        public Expression processOccurs​(StartTagInfo startTag,
                                        Expression item)
        Adds maxOccurs/minOccurs semantics to a given expression. For example, if this method receives A, minOccurs=0, and maxOccurs=3, then this method should return something like (A,(A,A?)?)?
      • processOccurs

        public Expression processOccurs​(Expression item,
                                        int minOccurs,
                                        int maxOccurs)
        Adds maxOccurs/minOccurs semantics to a given expression.
        Parameters:
        maxOccurs - -1 to represent "unbounded".
      • wrapUp

        protected void wrapUp()
        performs final wrap-up of parsing. this method is called by RootState after the parsing of the entire documents has completed.
      • getAdditionalNamespaceMap

        public Map<String,​String> getAdditionalNamespaceMap()
      • setAdditionalNamespaceMap

        public void setAdditionalNamespaceMap​(Map<String,​String> additionalNamespaceMap)