Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.Grammar


            }
            msr.parse(is);
        }
       
        public Schema getResult() {
            Grammar result = msr.getResult();
            if(result==null)    return null;
            else                return new SchemaImpl(result);
        }
View Full Code Here


import com.sun.msv.reader.dtd.DTDReader;

public class DTDValidator extends AbstractValidatorExImpl {

    public Grammar parseSchema( InputSource is, GrammarReaderController controller ) throws Exception {
        Grammar g = DTDReader.parse(is,controller,new ExpressionPool() );
        if(g==null)        return null;
        return g;
    }
View Full Code Here

        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);

        // load a grammar.
        Grammar g = GrammarLoader.loadSchema(args[0], new DebugController(false, false, System.err), factory);

        if (g == null) {
            System.err.println(localize(MSG_GRAMMAR_ERROR));
            return;
        }
View Full Code Here

                if( grammars[i] instanceof GrammarImpl )
                    ((GrammarImpl)grammars[i]).connect(grammars);
           
            // take union of them
            for( int i=0; i<grammarInfos.length; i++ ) {
                Grammar n = grammars[i];
                if( bgm == null )   bgm = n;
                else                bgm = union( bgm, n );
            }
        }
        return bgm;
View Full Code Here

        // either g1.getPool() or g2.getPool() is OK.
        // this is just a metter of performance problem.
        final ExpressionPool pool = g1.getPool();
        final Expression top = pool.createChoice(g1.getTopLevel(),g2.getTopLevel());
       
        return new Grammar() {
            public ExpressionPool getPool() {
                return pool;
            }
            public Expression getTopLevel() {
                return top;
View Full Code Here

    // parse schema
    //--------------------
        final long stime = System.currentTimeMillis();
        System.out.println( localize(MSG_START_PARSING_GRAMMAR) );

        Grammar grammar=null;
        try {
            GrammarLoader loader = new GrammarLoader();
           
            // set various parameters
            loader.setController( new DebugController(warning,false,entityResolver) );
View Full Code Here

   
   
    public Schema compileSchema( InputSource source )
        throws VerifierConfigurationException, SAXException {
        try {
            Grammar g = parse(source,new ThrowController());
            if(g==null)
                // theoretically this isn't possible because we throw an exception
                // if an error happens.
                throw new VerifierConfigurationException("unable to parse the schema");
            return new SchemaImpl(g,factory,usePanicMode);
View Full Code Here

    public static REDocumentDeclaration loadVGM( String url,
        GrammarReaderController controller,
        SAXParserFactory factory )
        throws SAXException, ParserConfigurationException, java.io.IOException
    {
        Grammar g = loadSchema(url,controller,factory);
        if(g!=null)        return wrapByVGM(g);
        else            return null;
    }
View Full Code Here

    public static REDocumentDeclaration loadVGM( InputSource source,
        GrammarReaderController controller,
        SAXParserFactory factory )
        throws SAXException, ParserConfigurationException, java.io.IOException
    {
        Grammar g = loadSchema(source,controller,factory);
        if(g!=null)        return wrapByVGM(g);
        else            return null;
    }
View Full Code Here

    }
   
    public REDocumentDeclaration parseVGM( String url )
        throws SAXException, ParserConfigurationException, java.io.IOException {
       
        Grammar g = _loadSchema(url);
        if(g==null)        return null;
        else            return new REDocumentDeclaration(g);
    }
View Full Code Here

TOP

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

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.