Examples of SchemaParser


Examples of com.volantis.mcs.build.parser.SchemaParser

                            "com.volantis.xml.xerces.parsers.SAXParser",
                            false);

            Document document = builder.build(marinerSchema);

            parser = new SchemaParser(new Factory());
            parser.addProcessingInstructionTarget("imdapi",
                    new IMDAPITarget());
            parser.addProcessingInstructionTarget("imdapiType",
                    new IMDAPITypeTarget());
View Full Code Here

Examples of com.volantis.mcs.build.parser.SchemaParser

                    new SAXBuilder("com.volantis.xml.xerces.parsers.SAXParser",
                            false);

            Document document = builder.build(schema);

            parser = new SchemaParser(new Factory());

            List schemaObjects = parser.parse(document);

            remoteDir =
                    new File(generatedDir, generatedPackage.replace('.', '/'));
View Full Code Here

Examples of com.volantis.mcs.build.parser.SchemaParser

                                     false);

            Document document = builder.build(themeSchema);

            // instantiate the parser
            parser = new SchemaParser(new ThemeFactory());

            // add all the processing instructions
            parser.addProcessingInstructionTarget(
                    "property", new ThemeTarget());
View Full Code Here

Examples of com.volantis.mcs.build.parser.SchemaParser

                    = new SAXBuilder(
                            "com.volantis.xml.xerces.parsers.SAXParser",
                            false);
            Document document = builder.build(schema);

            SchemaParser parser = new SchemaParser(new Factory());
            parser.addProcessingInstructionTarget("deprecated",
                    new DeprecatedTarget());
            parser.addProcessingInstructionTarget("papi",
                    new PAPITarget());

            List schemaObjects = parser.parse(document);

            initialiseExtraInfo(schemaObjects, parser.getScope());
            schemaPreamble();
            for (Iterator i = schemaObjects.iterator(); i.hasNext();) {
                SchemaObject object = (SchemaObject) i.next();
                processSchemaObject(object);
            }
            schemaPostamble();
            writeTagLibraries();

            generateMarlinElementHandlerFactory(parser.getScope());
        } catch (IOException ioe) {
            ioe.printStackTrace();
            return;
        } catch (JDOMException jdome) {
            jdome.printStackTrace();
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

    public ValidationHandler getValidationHandler(Source source, String grammar,
                                               ErrorHandler errorHandler)
    throws IOException, SAXException, ValidatorException {
        if (errorHandler == null) errorHandler = DraconianErrorHandler.INSTANCE;

        SchemaParser parser = null;
        try {
            /* If no grammar was supplied, try to detect one */
            if (grammar == null) grammar = this.detectGrammar(source);

            /* Save the grammar name and try to find a schema parser */
            String language = grammar;
            parser = this.lookupParserByGrammar(grammar);

            /*
             * If the schema parser for the language was not found, we might have to
             * look up for the form name:grammar as specified by Validator.
             */
            if (parser == null) {
                int index = grammar.indexOf(':');
                if (index > 0) {
                    String name = grammar.substring(0, index);
                    language = grammar.substring(index + 1);
                    parser = this.lookupParserByName(name);
                }
            }

            /* If still we didn't find any parser, simply die of natural death */
            if (parser == null) {
                String message = "Unsupported grammar language" + grammar;
                throw new ValidatorException(message);
            }

            /* Somehow we have a schema parser, check it supports the gramar */
            String languages[] = parser.getSupportedGrammars();
            for (int x = 0; x < languages.length; x++) {
                if (! language.equals(languages[x])) continue;
                /* Hah! language supported, go ahead and parse now */
                Schema schema = this.getSchema(parser, source, language);
                return schema.createValidator(errorHandler);
            }

            /* Something really odd going on, this should never happen */
            String message = "Schema parser " + parser.getClass().getName() +
                             " does not support grammar " + grammar;
            throw new ValidatorException(message);

        } finally {
            if (parser != null) this.releaseParser(parser);
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

            /* Dump some debugging information, just in case */
            this.logger.debug("Configuring schema parser " + selectionKey + " as "
                              + className + " from " + configuration.getLocation());

            /* Try to load and instantiate the SchemaParser */
            final SchemaParser schemaParser;
            try {
                /* Load the class */
                final Class clazz = Class.forName(className);

                /* ClassCastExceptions normally don't come with messages (darn) */
                if (! SchemaParser.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + SchemaParser.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* We only support ThreadSafe SchemaParser instances */
                if (! ThreadSafe.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + ThreadSafe.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* Instantiate and set up the new SchemaParser */
                schemaParser = (SchemaParser) clazz.newInstance();
                this.setupComponent(selectionKey, schemaParser, configuration);

            } catch (ConfigurationException exception) {
                throw exception;
            } catch (Exception exception) {
                String message = "Unable to instantiate SchemaParser " + className;
                throw new ConfigurationException(message, configuration, exception);
            }

            /* Store this instance (and report about it) */
            this.components.put(selectionKey, schemaParser);
            this.logger.debug("SchemaParser \"" + selectionKey + "\" instantiated" +
                              " from class " + className);

            /* Analyze the grammars provided by the current SchemaParser */
            String grammars[] = schemaParser.getSupportedGrammars();
            if (grammars == null) continue;

            /* Iterate through the grammars and store them (default lookup) */
            for (int k = 0; k < grammars.length; k++) {
                if (this.grammars.containsKey(grammars[k])) {
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

    public ValidationHandler getValidationHandler(Source source, String grammar,
                                               ErrorHandler errorHandler)
    throws IOException, SAXException, ValidatorException {
        if (errorHandler == null) errorHandler = DraconianErrorHandler.INSTANCE;

        SchemaParser parser = null;
        try {
            /* If no grammar was supplied, try to detect one */
            if (grammar == null) grammar = this.detectGrammar(source);

            /* Save the grammar name and try to find a schema parser */
            String language = grammar;
            parser = this.lookupParserByGrammar(grammar);

            /*
             * If the schema parser for the language was not found, we might have to
             * look up for the form name:grammar as specified by Validator.
             */
            if (parser == null) {
                int index = grammar.indexOf(':');
                if (index > 0) {
                    String name = grammar.substring(0, index);
                    language = grammar.substring(index + 1);
                    parser = this.lookupParserByName(name);
                }
            }

            /* If still we didn't find any parser, simply die of natural death */
            if (parser == null) {
                String message = "Unsupported grammar language" + grammar;
                throw new ValidatorException(message);
            }

            /* Somehow we have a schema parser, check it supports the gramar */
            String languages[] = parser.getSupportedGrammars();
            for (int x = 0; x < languages.length; x++) {
                if (! language.equals(languages[x])) continue;
                /* Hah! language supported, go ahead and parse now */
                Schema schema = this.getSchema(parser, source, language);
                return schema.createValidator(errorHandler);
            }

            /* Something really odd going on, this should never happen */
            String message = "Schema parser " + parser.getClass().getName() +
                             " does not support grammar " + grammar;
            throw new ValidatorException(message);

        } finally {
            if (parser != null) this.releaseParser(parser);
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

            /* Dump some debugging information, just in case */
            this.logger.debug("Configuring schema parser " + selectionKey + " as "
                              + className + " from " + configuration.getLocation());

            /* Try to load and instantiate the SchemaParser */
            final SchemaParser schemaParser;
            try {
                /* Load the class */
                final Class clazz = Class.forName(className);

                /* ClassCastExceptions normally don't come with messages (darn) */
                if (! SchemaParser.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + SchemaParser.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* We only support ThreadSafe SchemaParser instances */
                if (! ThreadSafe.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + ThreadSafe.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* Instantiate and set up the new SchemaParser */
                schemaParser = (SchemaParser) clazz.newInstance();
                this.setupComponent(selectionKey, schemaParser, configuration);

            } catch (ConfigurationException exception) {
                throw exception;
            } catch (Exception exception) {
                String message = "Unable to instantiate SchemaParser " + className;
                throw new ConfigurationException(message, configuration, exception);
            }

            /* Store this instance (and report about it) */
            this.components.put(selectionKey, schemaParser);
            this.logger.debug("SchemaParser \"" + selectionKey + "\" instantiated" +
                              " from class " + className);

            /* Analyze the grammars provided by the current SchemaParser */
            String grammars[] = schemaParser.getSupportedGrammars();
            if (grammars == null) continue;

            /* Iterate through the grammars and store them (default lookup) */
            for (int k = 0; k < grammars.length; k++) {
                if (this.grammars.containsKey(grammars[k])) {
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

    public ValidationHandler getValidationHandler(Source source, String grammar,
                                               ErrorHandler errorHandler)
    throws IOException, SAXException, ValidatorException {
        if (errorHandler == null) errorHandler = DraconianErrorHandler.INSTANCE;

        SchemaParser parser = null;
        try {
            /* If no grammar was supplied, try to detect one */
            if (grammar == null) grammar = this.detectGrammar(source);

            /* Save the grammar name and try to find a schema parser */
            String language = grammar;
            parser = this.lookupParserByGrammar(grammar);

            /*
             * If the schema parser for the language was not found, we might have to
             * look up for the form name:grammar as specified by Validator.
             */
            if (parser == null) {
                int index = grammar.indexOf(':');
                if (index > 0) {
                    String name = grammar.substring(0, index);
                    language = grammar.substring(index + 1);
                    parser = this.lookupParserByName(name);
                }
            }

            /* If still we didn't find any parser, simply die of natural death */
            if (parser == null) {
                String message = "Unsupported grammar language" + grammar;
                throw new ValidatorException(message);
            }

            /* Somehow we have a schema parser, check it supports the gramar */
            String languages[] = parser.getSupportedGrammars();
            for (int x = 0; x < languages.length; x++) {
                if (! language.equals(languages[x])) continue;
                /* Hah! language supported, go ahead and parse now */
                Schema schema = this.getSchema(parser, source, language);
                return schema.createValidator(errorHandler);
            }

            /* Something really odd going on, this should never happen */
            String message = "Schema parser " + parser.getClass().getName() +
                             " does not support grammar " + grammar;
            throw new ValidatorException(message);

        } finally {
            if (parser != null) this.releaseParser(parser);
View Full Code Here

Examples of org.apache.cocoon.components.validation.SchemaParser

            /* Dump some debugging information, just in case */
            this.logger.debug("Configuring schema parser " + selectionKey + " as "
                              + className + " from " + configuration.getLocation());

            /* Try to load and instantiate the SchemaParser */
            final SchemaParser schemaParser;
            try {
                /* Load the class */
                final Class clazz = Class.forName(className);

                /* ClassCastExceptions normally don't come with messages (darn) */
                if (! SchemaParser.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + SchemaParser.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* We only support ThreadSafe SchemaParser instances */
                if (! ThreadSafe.class.isAssignableFrom(clazz)) {
                    String message = "Class " + className + " doesn't implement the "
                                     + ThreadSafe.class.getName() + " interface";
                    throw new ConfigurationException(message, configuration);
                }

                /* Instantiate and set up the new SchemaParser */
                schemaParser = (SchemaParser) clazz.newInstance();
                this.setupComponent(selectionKey, schemaParser, configuration);

            } catch (ConfigurationException exception) {
                throw exception;
            } catch (Exception exception) {
                String message = "Unable to instantiate SchemaParser " + className;
                throw new ConfigurationException(message, configuration, exception);
            }

            /* Store this instance (and report about it) */
            this.components.put(selectionKey, schemaParser);
            this.logger.debug("SchemaParser \"" + selectionKey + "\" instantiated" +
                              " from class " + className);

            /* Analyze the grammars provided by the current SchemaParser */
            String grammars[] = schemaParser.getSupportedGrammars();
            if (grammars == null) continue;

            /* Iterate through the grammars and store them (default lookup) */
            for (int k = 0; k < grammars.length; k++) {
                if (this.grammars.containsKey(grammars[k])) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.