Package com.sun.msv.grammar.xmlschema

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


        reader.addBackPatchJob( new GrammarReader.BackPatch(){
            public State getOwnerState() {
                return SimpleContentExtensionState.this;
            }
            public void patch() {
                SimpleTypeExp sexp = schema.simpleTypes.get(baseTypeName[1]);
                if(sexp!=null) {
                    // we've found the simple type
                    ref.exp = sexp;
                    parentDecl.simpleBaseType = sexp.getType();
                    _assert(parentDecl.simpleBaseType!=null);
                    return;
                }
                ComplexTypeExp cexp = schema.complexTypes.get(baseTypeName[1]);
                if(cexp!=null) {
View Full Code Here


     */
    public SimpleTypeExp resolveBuiltinSimpleType( String typeLocalName ) {
        // datatypes of XML Schema part 2
        try {
            XSDatatype dt = DatatypeFactory.getTypeByName(typeLocalName);
            SimpleTypeExp sexp = xsdSchema.simpleTypes.getOrCreate(typeLocalName);
            if(!sexp.isDefined())
                sexp.set( new XSDatatypeExp(dt,pool) );
            return sexp;
        } catch( DatatypeException e ) {
            return null;    // not found.
        }
    }
View Full Code Here

            // the name was not found.
            // maybe we are parsing schema for schema.
            // consult the externally defined types.
        }

        final SimpleTypeExp sexp = getOrCreateSchema(r[0]).simpleTypes.
            getOrCreate(r[1]);
        backwardReference.memorizeLink(sexp);
                
        // simple type might be re-defined later.
        // therefore, we always need a late-binding datatype,
        // even if the datatype is defined already.
       
        return new XSDatatypeExp(r[0],r[1],this,new XSDatatypeExp.Renderer(){
            public XSDatatype render( XSDatatypeExp.RenderingContext context ) {
                if(sexp.getType()!=null)
                    return sexp.getType().getType(context);
                else
                    // undefined error is alreadyreported by
                    // the detectUndefinedOnes(simpleTypes) method
                    // so silently recover by using some sort of expression
                    return StringType.theInstance;
View Full Code Here

                    // this type can substitute the current type.
                    contentModel = cexp;
                else
                    return onNotSubstitutableType(sti,type,refErr);
            } else {
                SimpleTypeExp sexp = schema.simpleTypes.get(typeName[1]);
                if(sexp==null)    return onTypeResolutionFailure(sti,type,refErr);
               
                if(!(currentType instanceof SimpleTypeExp))
                    return onNotSubstitutableType(sti,type,refErr);
               
                SimpleTypeExp curT = (SimpleTypeExp)currentType;
                if(sexp.getDatatype().isDerivedTypeOf(
                    curT.getDatatype(), !xe.parent.isRestrictionBlocked() ))
                    contentModel = sexp;
                else
                    return onNotSubstitutableType(sti,type,refErr);
            }
        }
View Full Code Here

       
        if( tag.localName.equals("simpleType") ) {
            final XMLSchemaReader reader = (XMLSchemaReader)this.reader;
            String name = tag.getAttribute("name");
           
            SimpleTypeExp sexp = reader.currentSchema.simpleTypes.get(name);
            if( sexp==null ) {
                reader.reportError( XMLSchemaReader.ERR_REDEFINE_UNDEFINED, name );
                // recover by using an empty declaration
                sexp = reader.currentSchema.simpleTypes.getOrCreate(name);
            }
           
            reader.currentSchema.simpleTypes.redefine( name, sexp.getClone() );
           
            oldSimpleTypeExp = sexp;    // memorize this declaration
        }
       
        return super.createChildState(tag);
View Full Code Here

            reader.reportError( XMLSchemaReader.ERR_MISSING_ATTRIBUTE, "simpleType", "name" );
            return;    // recover by ignoring this declaration
        }
       
        // memorize this type.
        final SimpleTypeExp exp = reader.currentSchema.simpleTypes.getOrCreate(typeName);
        if(exp.getType()!=null ) {
            reader.reportError( XMLSchemaReader.ERR_DATATYPE_ALREADY_DEFINED, typeName );
            return;
            // recover by ignoring this declaration
        }
       
        exp.set(type);
        reader.setDeclaredLocationOf(exp);
    }
View Full Code Here

        reader.addBackPatchJob( new GrammarReader.BackPatch(){
            public State getOwnerState() {
                return SimpleContentRestrictionState.this;
            }
            public void patch() {
                SimpleTypeExp sexp = baseSchema.simpleTypes.get(baseTypeName[1]);
                if(sexp!=null) {
                    // we've found the simple type
                    parentDecl.simpleBaseType = sexp.getType();
                    _assert(parentDecl.simpleBaseType!=null);
                    return;
                }
                ComplexTypeExp cexp = baseSchema.complexTypes.get(baseTypeName[1]);
                if(cexp!=null) {
View Full Code Here

    private class BaseContentTypeRenderer implements  XSDatatypeExp.Renderer {
        public XSDatatype render( XSDatatypeExp.RenderingContext context ) {
            final XMLSchemaReader reader = (XMLSchemaReader)
                SimpleContentRestrictionState.this.reader;
           
            SimpleTypeExp sexp = baseSchema.simpleTypes.get(baseTypeName[1]);
            if(sexp!=null) {
                // we've found the simple type as the base type
                return sexp.getType().getType(context);
            }
            ComplexTypeExp cexp = baseSchema.complexTypes.get(baseTypeName[1]);
            if(cexp!=null) {
                // we've found the complex type as the base type
                // look for XSDatatypeExp inside
View Full Code Here

            reader.reportError( XMLSchemaReader.ERR_MISSING_ATTRIBUTE, "simpleType", "name" );
            return;    // recover by ignoring this declaration
        }
       
        // memorize this type.
        final SimpleTypeExp exp = reader.currentSchema.simpleTypes.getOrCreate(typeName);
        if(exp.getType()!=null ) {
            reader.reportError( XMLSchemaReader.ERR_DATATYPE_ALREADY_DEFINED, typeName );
            return;
            // recover by ignoring this declaration
        }
       
        exp.set(type);
        reader.setDeclaredLocationOf(exp);
    }
View Full Code Here

        reader.addBackPatchJob( new GrammarReader.BackPatch(){
            public State getOwnerState() {
                return SimpleContentRestrictionState.this;
            }
            public void patch() {
                SimpleTypeExp sexp = baseSchema.simpleTypes.get(baseTypeName[1]);
                if(sexp!=null) {
                    // we've found the simple type
                    parentDecl.simpleBaseType = sexp.getType();
                    _assert(parentDecl.simpleBaseType!=null);
                    return;
                }
                ComplexTypeExp cexp = baseSchema.complexTypes.get(baseTypeName[1]);
                if(cexp!=null) {
View Full Code Here

TOP

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

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.