Package com.sun.msv.reader.datatype.xsd

Examples of com.sun.msv.reader.datatype.xsd.XSDatatypeExp$Renderer


        final XMLSchemaReader reader = (XMLSchemaReader)this.reader;

        parentDecl.derivationMethod = ComplexTypeExp.RESTRICTION;
       
        try {
            XSDatatypeExp p = getIncubator().derive(null,null);
            exp = reader.pool.createSequence(
                 super.annealExpression(exp),
                 p );
        } catch( DatatypeException e ) {
            // derivation failed
            reader.reportError( e, XMLSchemaReader.ERR_BAD_TYPE, e.getMessage() );
            // recover by using harmless expression. anything will do.
            return Expression.nullSet;
        }
       

        // we need a special handling for built-in types
        if(reader.isSchemaNamespace(baseTypeName[0])) {
            XSDatatype dt = reader.resolveBuiltinDataType(baseTypeName[1]);
            if(dt!=null) {
                parentDecl.simpleBaseType = new XSDatatypeExp(dt,reader.pool);
                return exp;
            }
        }
       
        // in other cases, we don't know the base type yet.
View Full Code Here


       
        return super.createExpressionChildState(parent,tag);
    }

    public XSDatatypeExp resolveXSDatatype( String qName ) {
        return new XSDatatypeExp( (XSDatatype)resolveDatatype(qName),pool);
    }
View Full Code Here

                    startTag.getAttribute("form") );
       
            if( fixed!=null ) {
                if(contentType instanceof XSDatatypeExp ) {
                    // we know that the attribute value is of XSDatatypeExp
                    final XSDatatypeExp baseType = (XSDatatypeExp)contentType;
                   
                    try {
                        XSTypeIncubator inc = baseType.createIncubator();
                        inc.addFacet("enumeration",fixed,false,reader);
                   
                        contentType = inc.derive(null,null);
                    } catch( DatatypeException e ) {
                        reader.reportError( e, XMLSchemaReader.ERR_BAD_TYPE, e.getMessage() );
View Full Code Here

       
        // we need a special handling for built-in types
        if(reader.isSchemaNamespace(baseTypeName[0])) {
            XSDatatype dt = reader.resolveBuiltinDataType(baseTypeName[1]);
            if(dt!=null) {
                XSDatatypeExp dtexp = new XSDatatypeExp(dt,reader.pool);
                parentDecl.simpleBaseType = dtexp;
                return dtexp;
            }
           
            // maybe we are parsing the schema for schema.
View Full Code Here

        // 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

        if(r==null) {
            reportError( ERR_UNDECLARED_PREFIX, typeQName );
            // TODO: implement UndefinedType, that is used only when an error is encountered.
            // it should accept anything and any facets.
            // recover by assuming string.
            return  new XSDatatypeExp(StringType.theInstance,pool);
        }
       
        if( isSchemaNamespace(r[0]) ) {
            // internal definitions should be consulted first.
            XSDatatype dt = resolveBuiltinDataType(r[1]);
            if(dt!=null) return new XSDatatypeExp(dt,pool);
           
            // 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
View Full Code Here

     * to report an error, and recovers.
     */
    public XSDatatypeExp resolveXSDatatype( String typeName ) {
        // look up user defined types first
        try {
            XSDatatypeExp e = (XSDatatypeExp)userDefinedTypes.get(typeName);
            if(e!=null)     return e;
           
            // then try as a built-in type
            // if this method fails, it throws an exception
            return new XSDatatypeExp( DatatypeFactory.getTypeByName(typeName), pool );
        } catch( DatatypeException e ) {
           
            XSDatatype dt = getBackwardCompatibleType(typeName);
           
            if(typeName.equals("none"))         dt = NoneType.theInstance;
            if(typeName.equals("emptyString"))  dt = EmptyStringType.theInstance;
           
            if(dt==null) {
                reportError( ERR_UNDEFINED_DATATYPE, typeName );
                dt = NoneType.theInstance;    // recover by assuming a valid DataType
            }
           
            return new XSDatatypeExp( dt, pool );
        }
    }
View Full Code Here

        runBackPatchJob();
       
        // register user-defined types to the module
        Iterator itr = userDefinedTypes.entrySet().iterator();
        while( itr.hasNext() ) {
            XSDatatypeExp e = (XSDatatypeExp)((Map.Entry)itr.next()).getValue();
            module.datatypes.add(e.getCreatedType());
        }
       
        // combine expressions to their masters.
        // if no master is found, then create a new AttPool.
        {
View Full Code Here

TOP

Related Classes of com.sun.msv.reader.datatype.xsd.XSDatatypeExp$Renderer

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.