Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.Expression


    protected Expression    contentModel;
    protected short            connectorType;
    protected final short    CONNECTOR_UNKNOWN = -999;
   
    public void childElement( String elementName, short occurence ) {
        Expression exp = processOccurs(
                grammar.namedPatterns.getOrCreate(elementName),
                occurence);
       
        if( connectorType == CONNECTOR_UNKNOWN ) {
            // this must be the first child element within this model group.
View Full Code Here


        contentModel = null;
        connectorType = CONNECTOR_UNKNOWN;
    }
   
    public void endModelGroup( short occurence ) {
        Expression exp = processOccurs( contentModel, occurence );
        // pop context
        contentModel = contextStack.exp;
        connectorType = contextStack.connectorType;
        contextStack = contextStack.previous;
       
View Full Code Here

            // the first attribute for this element.
            attList = new java.util.HashMap();
            attributeDecls.put(elementName,attList);
        }
       
        Expression body = createAttributeBody(
            elementName,attributeName,attributeType,enums,
            attributeUse,defaultValue);
   
        AttModel am = new AttModel( body, attributeUse==USE_REQUIRED );
        setDeclaredLocationOf(am);
View Full Code Here

        Datatype dt = createDatatype(attributeType);
       
        StringPair str = new StringPair("",attributeType);
       
        if(enums!=null) {
            Expression exp = Expression.nullSet;
            for( int i=0; i<enums.length; i++ )
                exp = grammar.pool.createChoice( exp,
                    grammar.pool.createValue(dt,str,
                        dt.createValue(enums[i],null)));
            return exp;
View Full Code Here

     */
    protected ReferenceExp createElementDeclaration( String elementName ) {
        final Map attList = (Map)attributeDecls.get(elementName);
       
       
        Expression contentModel = Expression.epsilon;
       
        if(attList!=null) {
            // create AttributeExps and append it to tag.
            Iterator jtr = attList.keySet().iterator();
            while( jtr.hasNext() ) {
                String attName = (String)jtr.next();
                AttModel model = (AttModel)attList.get(attName);
                       
                // wrap it by AttributeExp.
                Expression exp = grammar.pool.createAttribute(
                    getNameClass(attName,true), model.value );
       
                // apply attribute use.
                // unless USE_REQUIRED, the attribute is optional.
                if( !model.required )
View Full Code Here

        if( !startTag.containsAttribute("ref") )
            // existance of @ref must be checked before instanciation of this object.
            throw new Error();
       
        // this this tag has @ref.
        Expression exp = reader.resolveQNameRef(
            startTag, "ref",
            new XMLSchemaReader.RefResolver() {
                public ReferenceContainer get( XMLSchemaSchema g ) {
                    return g.elementDecls;
                }
View Full Code Here

     * @return
     *        An expression that corresponds to the choice of all
     *        element declarations. This will be used to implement "ANY".
     */
    protected Expression createElementDeclarations() {
        Expression allExp = Expression.nullSet;
       
        // create declarations
        Iterator itr = elementDecls.keySet().iterator();
        while( itr.hasNext() ) {
            Expression exp = createElementDeclaration( (String)itr.next() );
            allExp = grammar.pool.createChoice( allExp, exp );
        }
       
        return allExp;
    }
View Full Code Here

    }
   
    public void endDTD() throws SAXException {
        // perform final wrap-up.
       
        final Expression allExp = createElementDeclarations();
       
       
        // set this allExp as the content model of "all" hedgeRule.
        // this special hedgeRule is used to implement ANY content model,
        // and this hedgeRule is also exported.
View Full Code Here

public abstract class ExpressionState extends SimpleState
{
    protected void endSelf()
    {
        // creates a expression, then calls a hook of reader,
        Expression exp = reader.interceptExpression( this, makeExpression() );
       
        if( parentState!=null )
            // then finally pass it to the parent
            ((ExpressionOwner)parentState).onEndChild(exp);
       
View Full Code Here

        final String combine = startTag.getCollapsedAttribute("combine");
       
        exp = callInterceptExpression(exp);
       
        // combine two patterns
        Expression newexp = doCombine( ref, exp, combine );
        if( newexp==null )
            reader.reportError( TREXBaseReader.ERR_BAD_COMBINE, combine );
            // recover by ignoring this definition
        else
            ref.exp = newexp;
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.