Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.ExpressionPool


     */
    public void setPool( ExpressionPool pool ) {
        this.pool = pool;
    }
    public ExpressionPool getPool() {
        if( pool==null)        return new ExpressionPool();
        else                return pool;
    }
View Full Code Here


   
    /** loads TREX pattern */
    public static TREXGrammar parse( String grammarURL,
        SAXParserFactory factory, GrammarReaderController controller )
    {
        TREXGrammarReader reader = new TREXGrammarReader(controller,factory,new ExpressionPool());
        reader.parse(grammarURL);
       
        return reader.getResult();
    }
View Full Code Here

   
    /** loads TREX pattern */
    public static TREXGrammar parse( InputSource grammar,
        SAXParserFactory factory, GrammarReaderController controller )
    {
        TREXGrammarReader reader = new TREXGrammarReader(controller,factory,new ExpressionPool());
        reader.parse(grammar);
       
        return reader.getResult();
    }
View Full Code Here

    }

   
    /** easy-to-use constructor. */
    public TREXGrammarReader( GrammarReaderController controller) {
        this(controller,createParserFactory(),new ExpressionPool());
    }
View Full Code Here

    }
   
    public XMLSchemaReader(
        GrammarReaderController controller,
        SAXParserFactory parserFactory ) {
        this( controller, parserFactory, new ExpressionPool() );
    }
View Full Code Here

* @author <a href="mailto:kohsuke.kawaguchi@eng.sun.com">Kohsuke KAWAGUCHI</a>
*/
public class XMLSchemaGrammar implements Grammar {

    public XMLSchemaGrammar() {
        this( new ExpressionPool() );
    }
View Full Code Here

    /**
     * Creates the expression that corresponds to
     * the current attribute wildcard specification.
     */
    public Expression createExpression( XMLSchemaGrammar grammar ) {
        final ExpressionPool pool = grammar.pool;
       
        switch(processMode) {
        case SKIP:
            return pool.createZeroOrMore(pool.createAttribute(name));
           
        case STRICT:
        case LAX:
           
            Expression exp = Expression.epsilon;
            LaxDefaultNameClass laxNc = new LaxDefaultNameClass(name);
           
            Iterator itr = grammar.iterateSchemas();
            while( itr.hasNext() ) {
                XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();
                // nc is built by using NamespaceNameClass.
                // "strict" allows global element declarations of
                // specified namespaces.
                if(name.accepts( schema.targetNamespace, NameClass.LOCALNAME_WILDCARD )) {
                   
                    // gather global attributes.
                    ReferenceExp[] atts = schema.attributeDecls.getAll();
                    for( int i=0; i<atts.length; i++ ) {
                        exp = pool.createSequence( pool.createOptional(atts[i]), exp );
                        laxNc.addName( schema.targetNamespace, atts[i].name );
                    }
                }
            }
               
            if( processMode==STRICT )
                // if processContents="strict", then that's it.
                return exp;
               
            // if "lax", we have to add an expression to
            // match other attributes.
            return pool.createSequence(
                pool.createZeroOrMore(pool.createAttribute(laxNc)), exp );
       
        default:
            throw new Error("undefined process mode:"+processMode);
        }
    }
View Full Code Here

        return reader.getResult();
    }

    /** easy-to-use constructor. */
    public RELAXNGCompReader( GrammarReaderController controller ) {
        this(controller,createParserFactory(),new ExpressionPool());
    }
View Full Code Here

    /** easy-to-use constructor. */
    public RELAXNGReader(
        GrammarReaderController controller,
        SAXParserFactory parserFactory) {
        // TODO: add s4s
        this(controller,parserFactory,new StateFactory(),new ExpressionPool());
    }
View Full Code Here

    }
   
    public static TREXGrammar parse( InputSource source,
        GrammarReaderController controller ) {
       
        return parse( source, controller, new ExpressionPool() );
    }
View Full Code Here

TOP

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

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.