Package com.sun.msv.grammar

Examples of com.sun.msv.grammar.Grammar


            ObjectInputStream ois = new ObjectInputStream( is );
            final Expression exp = (Expression)ois.readObject();
            final ExpressionPool pool = (ExpressionPool)ois.readObject();
            ois.close();
       
            return new Grammar() {
                public Expression getTopLevel() { return exp; }
                public ExpressionPool getPool() { return pool; }
            };
        } catch( IOException e ) {
            throw new InternalError(e.getMessage());
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

    public Schema compileSchema(InputSource source)
        throws VerifierConfigurationException, SAXException, IOException {
       
        try {
            Grammar grammar = SRELAXNGReader.parse( source, factory, new ThrowController() );
            if(grammar==null)
                throw new VerifierConfigurationException("unable to parse schema:"+source.getSystemId());
            return new RelamesSchemaImpl(grammar);
        } catch( WrapperException e ) {
            throw e.e;  // re-throw
View Full Code Here

    public static void doMain( String[] args ) throws Exception {
                System.out.println("parsing    "+args[0]);
                // parse a grammar
                SAXParserFactory factory = SAXParserFactory.newInstance();
                factory.setNamespaceAware(true);
                Grammar grammar = SRELAXNGReader.parse( args[0], factory, new DebugController(false,false) );
                if(grammar==null)       return;
               
                // setup verifier
                RelmesVerifier verifier = new RelmesVerifier(
                        new REDocumentDeclaration(grammar), new ReportErrorHandler() );
View Full Code Here

                + " with grammar: " + grammarUrl);
        Throwable cause;
        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setNamespaceAware(true);
            Grammar grammar = SRELAXNGReader.parse(
                    new InputSource(grammarUrl.openStream()),
                    factory, new DebugController(false, false));
            if (grammar == null)
                throw new RuntimeException(
                        "Unexpected failure parsing grammar URL '"
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

    }
   
    public REDocumentDeclaration parseVGM( InputSource source )
        throws SAXException, ParserConfigurationException, java.io.IOException {
       
        Grammar g = _loadSchema(source);
        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.