Package com.sun.msv.grammar.xmlschema

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


        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];
           
                recursiveSubstBuffer.clear();
               
                if(!controller.hadError()) {
                    // set the substitution group
View Full Code Here


            contentType = reader.pool.createValue(
                com.sun.msv.datatype.xsd.TokenType.theInstance,
                new StringPair("","token"), fixed ); // emulate RELAX NG built-in token type
       
       
        ElementDeclExp decl;
        if( isGlobal() ) {
            decl = reader.currentSchema.elementDecls.getOrCreate(name);
            if( decl.getElementExp()!=null )
                reader.reportError(
                    new Locator[]{this.location,reader.getDeclaredLocationOf(decl)},
                    XMLSchemaReader.ERR_DUPLICATE_ELEMENT_DEFINITION,
                    new Object[]{name} );
           
        } else {
            // create a local object.
            decl = new ElementDeclExp(reader.currentSchema,null);
        }
       
        reader.setDeclaredLocationOf(decl);

        ElementDeclExp.XSElementExp exp = decl.new XSElementExp(
            new SimpleNameClass(targetNamespace,name), contentType );
       
        // set the body.
        decl.setElementExp(exp);

        // set identity constraints
        exp.identityConstraints.addAll(idcs);
       
        // process the nillable attribute.
        String nillable = startTag.getAttribute("nillable");
        if( nillable!=null )
            decl.isNillable = nillable.equals("true") || nillable.equals("1");

        // process the "abstract" attribute.
        String abstract_ = startTag.getAttribute("abstract");
        decl.setAbstract( "true".equals(abstract_)||"1".equals(abstract_) );
        if( abstract_!=null && !BooleanType.theInstance.isValid(abstract_,null) )
            // recover by assuming false.
            reader.reportError( XMLSchemaReader.ERR_BAD_ATTRIBUTE_VALUE, "abstract", abstract_ );
       
        // TODO: abstract is prohibited for the local element.
       
        // TODO: substitutionGroup is also prohibited for the local element.   
        String substitutionGroupQName = startTag.getAttribute("substitutionGroup");
        if( substitutionGroupQName!=null ) {
            String[] r = reader.splitQName(substitutionGroupQName);
            if(r==null) {
                reader.reportError( XMLSchemaReader.ERR_UNDECLARED_PREFIX, substitutionGroupQName );
                // recover by ignoring substitutionGroup.
            } else {
                // register this declaration to the head elementDecl.
                ElementDeclExp head = reader.getOrCreateSchema(r[0]/*uri*/).
                    elementDecls.getOrCreate(r[1]/*local name*/);
               
                decl.substitutionAffiliation = head;
               
                // before adding this "decl" to "head.substitutions",
View Full Code Here

        System.out.println("\n $$$$$$[ " + s.targetNamespace + " ]$$$$$$");

        System.out.println("*** elementDecls ***");
        ReferenceExp[] es = s.elementDecls.getAll();
        for( int i=0; i<es.length; i++ ) {
            ElementDeclExp exp = (ElementDeclExp)es[i];
            System.out.println( exp.name + "  : " +
                ExpressionPrinter.printContentModel(
                    exp.getContentModel().getExpandedExp(s.pool)) );
        }
       
        System.out.println("*** complex types ***");
        System.out.print(
            ExpressionPrinter.contentModelInstance.printRefContainer(
View Full Code Here

    String name = startTag.getAttribute("name");
    if(name==null)
      // a global element decl must have a name. If not, it is an error.
      return body;  // abort
   
    final ElementDeclExp decl = reader.getCurrentSchema().elementDecls.getOrCreate(name);
   
    if( startTag.containsAttribute("substitutionGroup") ) {
      // if this element decl has a substitution affiliation,
      // back-patch the head and add InterfaceItem.
      // since decl.substitutionAffiliation may be still not forged,
View Full Code Here

        System.out.println("\n $$$$$$[ " + s.targetNamespace + " ]$$$$$$");

        System.out.println("*** elementDecls ***");
        ReferenceExp[] es = s.elementDecls.getAll();
        for( int i=0; i<es.length; i++ ) {
            ElementDeclExp exp = (ElementDeclExp)es[i];
            System.out.println( exp.name + "  : " +
                ExpressionPrinter.printContentModel(
                    exp.getContentModel().getExpandedExp(s.pool)) );
        }
       
        System.out.println("*** complex types ***");
        System.out.print(
            ExpressionPrinter.contentModelInstance.printRefContainer(
View Full Code Here

            contentType = reader.pool.createValue(
                com.sun.msv.datatype.xsd.TokenType.theInstance,
                new StringPair("","token"), fixed ); // emulate RELAX NG built-in token type
       
       
        ElementDeclExp decl;
        if( isGlobal() ) {
            decl = reader.currentSchema.elementDecls.getOrCreate(name);
            if( decl.getElementExp()!=null )
                reader.reportError(
                    new Locator[]{this.location,reader.getDeclaredLocationOf(decl)},
                    XMLSchemaReader.ERR_DUPLICATE_ELEMENT_DEFINITION,
                    new Object[]{name} );
           
        } else {
            // create a local object.
            decl = new ElementDeclExp(reader.currentSchema,null);
        }
       
        reader.setDeclaredLocationOf(decl);

        ElementDeclExp.XSElementExp exp = decl.new XSElementExp(
            new SimpleNameClass(targetNamespace,name), contentType );
       
        // set the body.
        decl.setElementExp(exp);

        // set identity constraints
        exp.identityConstraints.addAll(idcs);
       
        // process the nillable attribute.
        String nillable = startTag.getAttribute("nillable");
        if( nillable!=null )
            decl.isNillable = nillable.equals("true") || nillable.equals("1");

        // process the "abstract" attribute.
        String abstract_ = startTag.getAttribute("abstract");
        decl.setAbstract( "true".equals(abstract_)||"1".equals(abstract_) );
        if( abstract_!=null && !BooleanType.theInstance.isValid(abstract_,null) )
            // recover by assuming false.
            reader.reportError( XMLSchemaReader.ERR_BAD_ATTRIBUTE_VALUE, "abstract", abstract_ );
       
        // TODO: abstract is prohibited for the local element.
       
        // TODO: substitutionGroup is also prohibited for the local element.   
        String substitutionGroupQName = startTag.getAttribute("substitutionGroup");
        if( substitutionGroupQName!=null ) {
            String[] r = reader.splitQName(substitutionGroupQName);
            if(r==null) {
                reader.reportError( XMLSchemaReader.ERR_UNDECLARED_PREFIX, substitutionGroupQName );
                // recover by ignoring substitutionGroup.
            } else {
                // register this declaration to the head elementDecl.
                ElementDeclExp head = reader.getOrCreateSchema(r[0]/*uri*/).
                    elementDecls.getOrCreate(r[1]/*local name*/);
               
                decl.substitutionAffiliation = head;
               
                // before adding this "decl" to "head.substitutions",
View Full Code Here

        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];
           
                recursiveSubstBuffer.clear();
               
                if(!controller.hadError()) {
                    // set the substitution group
View Full Code Here

TOP

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

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.