cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject Does ValidatingTransformer support DTD validation
Date Mon, 20 Jun 2011 13:24:27 GMT
Hi all,

i am trying to use the validating transformer with a DTD but can't get it to work.

I already took a look at the source and found this block of code in http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-validation/cocoon-validation-impl/src/main/java/org/apache/cocoon/components/validation/jaxp/JaxpSchemaParser.java

I tried 

             <map:transform src="data/p-topic.dtd" type="validate">
               <map:parameter name="grammar" value="http://www.w3.org/TR/REC-xml"/>
             </map:transform>  
which does not work.

-------------------------------------------------------------------------
        /* Detect languages or use the supplied ones */
        Configuration languages[] = conf.getChild("grammars").getChildren("grammar");
        Set grammars = new HashSet();
        if (languages.length > 0) {

            /* If the configuration specified (formally) a list of grammars use it */
            for (int x = 0; x < languages.length; x++) {
                String language = languages[x].getValue();
                if (fact.isSchemaLanguageSupported(language)) {
                    grammars.add(language);
                    continue;
                }
                /* If the configured language is not supported throw an exception */
                String message = "JAXP SchemaFactory \"" + this.className + "\" " +
                                 "does not support configured grammar " + language;
                throw new ConfigurationException(message, languages[x]);
            }
        } else {

            /* Attempt to detect the languages directly using the JAXP factory */
            if (fact.isSchemaLanguageSupported(Validator.GRAMMAR_XML_SCHEMA)) {
                grammars.add(Validator.GRAMMAR_XML_SCHEMA);
            }
            if (fact.isSchemaLanguageSupported(Validator.GRAMMAR_RELAX_NG)) {
                grammars.add(Validator.GRAMMAR_RELAX_NG);
            }
            if (fact.isSchemaLanguageSupported(Validator.GRAMMAR_XML_DTD)) {
                grammars.add(Validator.GRAMMAR_XML_DTD);  //this equals "http://www.w3.org/TR/REC-xml"
            }
        }


Is there a way to configure support for DTD validation as well?  XML schema validation seems
to work out-of-the-box.

Kind regards,
Robby

Mime
View raw message