Package com.sun.msv.grammar.xmlschema

Examples of com.sun.msv.grammar.xmlschema.XMLSchemaSchema


     * If there is no such object, this method creates a new instance and
     * returns it.
     */
    public XMLSchemaSchema getOrCreateSchema( String namespaceURI ) {
       
        XMLSchemaSchema g = (XMLSchemaSchema)grammar.getByNamespace(namespaceURI);
        if(g!=null)        return g;
       
        // create new one.
        g = new XMLSchemaSchema(namespaceURI,grammar);
       
        // memorize the first link so that we can report the source of error
        // if this namespace turns out to be undefined.
        backwardReference.memorizeLink(g);
       
View Full Code Here


       
        // TODO: undefined grammar check.
        Expression grammarTopLevel = Expression.nullSet;
        itr = grammar.iterateSchemas();
        while( itr.hasNext() ) {
            XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();
           
            if( !isSchemaDefined(schema) ) {
                reportError(
                    backwardReference.getReferer(schema),
                    ERR_UNDEFINED_SCHEMA,
                    new Object[]{schema.targetNamespace} );
                return;    // surpress excessive error messages.
            }
           
            // detect undefined declarations.
            detectUndefinedOnes( schema.attributeDecls,        ERR_UNDEFINED_ATTRIBUTE_DECL );
            detectUndefinedOnes( schema.attributeGroups,    ERR_UNDEFINED_ATTRIBUTE_GROUP );
            detectUndefinedOnes( schema.complexTypes,        ERR_UNDEFINED_COMPLEX_TYPE );
            detectUndefinedOnes( schema.elementDecls,        ERR_UNDEFINED_ELEMENT_DECL );
            detectUndefinedOnes( schema.groupDecls,            ERR_UNDEFINED_GROUP );
            detectUndefinedOnes( schema.simpleTypes,        ERR_UNDEFINED_SIMPLE_TYPE );
           
           
            // TODO: it is now possible to check that the derivation doesn't
            // violate the final property of the parent type.
           
            // prepare top-level expression.
            // at the same time, compute the substitutions field of ElementDeclExps.
            // TODO: make sure this is a correct implementation
            // any globally declared element can be a top-level element.
            Expression exp = Expression.nullSet;
            ReferenceExp[] elems = schema.elementDecls.getAll();
            for( int i=0; i<elems.length; i++ )
                exp = pool.createChoice( exp, elems[i] );
           
            schema.topLevel = exp;
           
            // toplevel of the grammar will be choices of toplevels of all modules.
            grammarTopLevel = pool.createChoice( grammarTopLevel, exp );
        }

        // some of the back-patching process relies on this grammar.topLevel field.
        grammar.topLevel = grammarTopLevel;

        // perform all back patching.
        runBackPatchJob();

       
       
       
        // perform substitutability computation
        //-----------------------------------------
        // this process depends on the result of back-patching.
       
        // a buffer which will be used to check the recursive substitution group definition.
        final Set<ElementDeclExp> recursiveSubstBuffer = new java.util.HashSet<ElementDeclExp>();
       
        itr = grammar.iterateSchemas();
        while( itr.hasNext() ) {
            XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();

            ReferenceExp[] elems = schema.elementDecls.getAll();
            for( int i=0; i<elems.length; i++ ) {
                final ElementDeclExp e = (ElementDeclExp)elems[i];
           
View Full Code Here

           
            // back patch "key" field of KeyRefConstraint.
            reader.addBackPatchJob( new GrammarReader.BackPatch(){
                public State getOwnerState() { return IdentityConstraintState.this; }
                public void patch() {
                    XMLSchemaSchema s = reader.grammar.getByNamespace(qn[0]);
                    if(s==null) {
                        reader.reportError( XMLSchemaReader.ERR_UNDEFINED_SCHEMA, qn[0] );
                        return;
                    }
                    IdentityConstraint idc = s.identityConstraints.get(qn[1]);
View Full Code Here

        if( reader.isSchemaDefined(reader.currentSchema) )  {
            reader.reportError( XMLSchemaReader.ERR_DUPLICATE_SCHEMA_DEFINITION, targetNs );
            // recover by providing dummy grammar object.
            // this object is not registered to the map,
            // so it cannot be referenced.
            reader.currentSchema = new XMLSchemaSchema(targetNs,reader.grammar);
        }
       
        reader.markSchemaAsDefined(reader.currentSchema);
    }
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.xmlschema.XMLSchemaSchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.