cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@onehippo.com>
Subject Re: Does ValidatingTransformer support DTD validation
Date Sun, 26 Jun 2011 22:31:02 GMT
Hi Robby,

have you checked this page [1]? I'm not sure if this is the same
component, but is might lead you further.

[1] http://wiki.apache.org/cocoon/ValidationTransformer

Jeroen

On Mon, Jun 20, 2011 at 3:24 PM, Robby Pelssers
<robby.pelssers@ciber.com> wrote:
> 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
>



-- 
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

Mime
View raw message