Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.Expression


        if(r==null) {
            reportError( ERR_UNDECLARED_PREFIX, refQName );
            return null;
        }
       
        Expression e =  resolver.get( getOrCreateSchema(r[0]/*uri*/) )._getOrCreate(r[1]/*local name*/);
        backwardReference.memorizeLink(e);
       
        return e;
    }
View Full Code Here


     *
     * @param   maxOccurs
     *      -1 to represent "unbounded".
     */
    public Expression processOccurs( Expression item, int minOccurs, int maxOccurs ) {
        Expression precise = _processOccurs(item,minOccurs,maxOccurs);
        if(maxOccurs==1)                    return precise;
        if(maxOccurs==-1 && minOccurs<=1 return precise;
        return new OccurrenceExp(precise,maxOccurs,minOccurs,item);
    }
View Full Code Here

        return new OccurrenceExp(precise,maxOccurs,minOccurs,item);
    }
   
    private Expression _processOccurs( Expression item, int minOccurs, int maxOccurs ) {

        Expression exp = Expression.epsilon;
        for( int i=0; i<minOccurs; i++ )
            exp = pool.createSequence( item, exp );
       
        if(maxOccurs==-1) {
            if( minOccurs==1 )
                return pool.createOneOrMore(item);
            else
                return pool.createSequence( exp, pool.createZeroOrMore(item) );
        }
               
        // create (A,(A, ... (A?)? ... )?
        Expression tmp = Expression.epsilon;
        for( int i=minOccurs; i<maxOccurs; i++ )
            tmp = pool.createOptional( pool.createSequence( item, tmp ) );
               
        return pool.createSequence( exp, tmp );
    }
View Full Code Here

       
        // mark schema namespace as defined
        markSchemaAsDefined(xsdSchema);       
       
        // 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;
View Full Code Here

                reader.reportError( RELAXCoreReader.ERR_MISSING_ATTRIBUTE, "element","name" );
                // recover by ignoring this element.
                return Expression.nullSet;
            }
           
            Expression contentModel;

            if( incubator!=null ) {
                contentModel = incubator.derive(null,null);
            } else {
                // @label is used
View Full Code Here

        firstChild = false;
        return newChild;
    }

    protected Expression annealExpression( Expression contentModel ) {
        Expression e = reader.pool.createAttribute( nameClass, contentModel );
        if(e instanceof AttributeExp)
            reader.setDeclaredLocationOf(e);
        return e;
    }
View Full Code Here

        String[] typeName = (String[])QnameType.theInstance.createJavaObject(type,sti.context);
        if(typeName==null)
            return onTypeResolutionFailure(sti,type,refErr);
       
       
        Expression contentModel;
       
        if( typeName[0].equals(XMLSchemaNamespace) ) {
            // special handling is required for built-in datatypes.
            try {
                contentModel = _docDecl.grammar.getPool().createData(
View Full Code Here

    protected Expression initialExpression() {
        final XMLSchemaReader reader = (XMLSchemaReader)this.reader;
       
        if( startTag.containsAttribute("ref") ) {
            // this this tag has @ref.
            Expression exp = reader.resolveQNameRef(
                startTag, "ref",
                new XMLSchemaReader.RefResolver() {
                    public ReferenceContainer get( XMLSchemaSchema g ) {
                        return g.groupDecls;
                    }
View Full Code Here

    protected Expression resolveElementRef( String namespace, String label ) {
        if( namespace!=null ) {
            reportError( ERR_NAMESPACE_NOT_SUPPROTED );
            return Expression.nullSet;
        }
        Expression exp = module.elementRules.getOrCreate(label);
        backwardReference.memorizeLink(exp);
        return exp;
    }
View Full Code Here

    protected Expression resolveHedgeRef( String namespace, String label ) {
        if( namespace!=null ) {
            reportError( ERR_NAMESPACE_NOT_SUPPROTED );
            return Expression.nullSet;
        }
        Expression exp = module.hedgeRules.getOrCreate(label);
        backwardReference.memorizeLink(exp);
        return exp;
    }
View Full Code Here

TOP

Related Classes of com.sun.msv.grammar.Expression

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.