RE: Does ValidatingTransformer support DTD validation
Hi David, yes it is and i tested it yesterday without any luck by the way. I am going to test some of my existing use cases with #cocoon3 in the next few days. I think it will be much easier for me to walk through the code as it is much leaner and meaner. Robby -Oorspronkelijk bericht- Van: David Crossley [mailto:cross...@apache.org] Verzonden: vr 1-7-2011 2:53 Aan: dev@cocoon.apache.org Onderwerp: Re: Does ValidatingTransformer support DTD validation Robby Pelssers wrote: Hi David, One thing I still need to investigate was Jeroen's reply: 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 I checked that (probably somewhat deprecated) documentation but i noticed something that could be usefull: map:transform type='validate' src='validation/xhtml1-transitional.dtd' map:parameter name='active' value='true'/ !-- this part -- /map:transform If i find some time this week I will check if setting that 'active' parameter to true does any good unless you beat me to it ;-) This is a different component to the Transformer that is in Cocoon SVN. -David winmail.dat
Re: Does ValidatingTransformer support DTD validation
David Crossley wrote: Robby Pelssers wrote: i am trying to use the validating transformer with a DTD but can't get it to work. IIRC when i set this up for Apache Forrest a while back, then i could not get DTD validation working either. So we converted the DTD to RELAX NG using Trang. Some of the notes and links here might help: http://forrest.apache.org/howto-dev.html#debug-validation https://issues.apache.org/jira/browse/FOR-1172 (I have been trying to investigate this for ages. Sorry, not much time, so i hope this much helps.) No matter what i do to configure the transformer, there are only three default grammar for SchemaParser instantiated (DEBUG messages in core.log). Two for RELAX NG and one for XML Schema, and none for DTD. Been twiddling sitemap.xmap (and forrest.xmap) and cocoon.xconf files. Trying to specify a grammar for the particular use in the sitemap match, then requesting the validation report gives Unsupported grammar language. Not specifying a grammar, then requesting the validation report gives The markup in the document preceding the root element must be well-formed The logs show that the DTD has been resolved by the catalog entity resolver. There is a message for Detecting grammar for the DTD, but no resolution message for detected for schema like there is for RNG validation. Then we get the error message for markup as above, a SAXParseException. This line of the DTD is the first !ENTITY ... declaration. So it is not parsing it as a DTD. Note that Forrest still uses Cocoon-2.1 but IIRC then this Validation block is the same. Need to look at the Cocoon Samples. Perhaps there is a reason that Pier did provide a DTD sample in the beginning. Typo: did *not* provide a DTD sample Another thought: I wonder if this is because our xml-parser is configured in cocoon.xconf to have validate=false. -David 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
RE: Does ValidatingTransformer support DTD validation
Hi David, One thing I still need to investigate was Jeroen's reply: 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 I checked that (probably somewhat deprecated) documentation but i noticed something that could be usefull: map:transform type='validate' src='validation/xhtml1-transitional.dtd' map:parameter name='active' value='true'/ !-- this part -- /map:transform If i find some time this week I will check if setting that 'active' parameter to true does any good unless you beat me to it ;-) Robby -Oorspronkelijk bericht- Van: David Crossley [mailto:cross...@apache.org] Verzonden: do 30-6-2011 8:46 Aan: dev@cocoon.apache.org Onderwerp: Re: Does ValidatingTransformer support DTD validation David Crossley wrote: Robby Pelssers wrote: i am trying to use the validating transformer with a DTD but can't get it to work. IIRC when i set this up for Apache Forrest a while back, then i could not get DTD validation working either. So we converted the DTD to RELAX NG using Trang. Some of the notes and links here might help: http://forrest.apache.org/howto-dev.html#debug-validation https://issues.apache.org/jira/browse/FOR-1172 (I have been trying to investigate this for ages. Sorry, not much time, so i hope this much helps.) No matter what i do to configure the transformer, there are only three default grammar for SchemaParser instantiated (DEBUG messages in core.log). Two for RELAX NG and one for XML Schema, and none for DTD. Been twiddling sitemap.xmap (and forrest.xmap) and cocoon.xconf files. Trying to specify a grammar for the particular use in the sitemap match, then requesting the validation report gives Unsupported grammar language. Not specifying a grammar, then requesting the validation report gives The markup in the document preceding the root element must be well-formed The logs show that the DTD has been resolved by the catalog entity resolver. There is a message for Detecting grammar for the DTD, but no resolution message for detected for schema like there is for RNG validation. Then we get the error message for markup as above, a SAXParseException. This line of the DTD is the first !ENTITY ... declaration. So it is not parsing it as a DTD. Note that Forrest still uses Cocoon-2.1 but IIRC then this Validation block is the same. Need to look at the Cocoon Samples. Perhaps there is a reason that Pier did provide a DTD sample in the beginning. Typo: did *not* provide a DTD sample Another thought: I wonder if this is because our xml-parser is configured in cocoon.xconf to have validate=false. -David 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
RE: Does ValidatingTransformer support DTD validation
I think i finally understand what is causing the difference. If you use the cocoon:/ protocol in your generator the Source is a SitemapSource (and instance of XMLizable) and it will be handled differently then if your generator would be pointing to a file. public static void parse(SAXParser parser, Source source, ContentHandler handler) throws SAXException, IOException, ProcessingException { if (source instanceof XMLizable) { toSAX((XMLizable) source, handler); //!!! for use-case map:generate src=cocoon:/somepipeline/xx/ } else { try { parser.parse(getInputSource(source), handler); //!!! for use-case map:generate src=mydata/document1.xml/ } catch (SourceException e) { throw SourceUtil.handle(e); } } } Can someone shed some light on how-to resolve my need to actually parse the source coming from calling another cocoon pipeline. This is specifically needed for DITA (and being able to use the DITA toolkit). Kind regards, Robby Pelssers -Oorspronkelijk bericht- Van: Robby Pelssers [mailto:robby.pelss...@ciber.com] Verzonden: do 30-6-2011 11:57 Aan: dev@cocoon.apache.org Onderwerp: RE: Does ValidatingTransformer support DTD validation Hi David, One thing I still need to investigate was Jeroen's reply: 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 I checked that (probably somewhat deprecated) documentation but i noticed something that could be usefull: map:transform type='validate' src='validation/xhtml1-transitional.dtd' map:parameter name='active' value='true'/ !-- this part -- /map:transform If i find some time this week I will check if setting that 'active' parameter to true does any good unless you beat me to it ;-) Robby -Oorspronkelijk bericht- Van: David Crossley [mailto:cross...@apache.org] Verzonden: do 30-6-2011 8:46 Aan: dev@cocoon.apache.org Onderwerp: Re: Does ValidatingTransformer support DTD validation David Crossley wrote: Robby Pelssers wrote: i am trying to use the validating transformer with a DTD but can't get it to work. IIRC when i set this up for Apache Forrest a while back, then i could not get DTD validation working either. So we converted the DTD to RELAX NG using Trang. Some of the notes and links here might help: http://forrest.apache.org/howto-dev.html#debug-validation https://issues.apache.org/jira/browse/FOR-1172 (I have been trying to investigate this for ages. Sorry, not much time, so i hope this much helps.) No matter what i do to configure the transformer, there are only three default grammar for SchemaParser instantiated (DEBUG messages in core.log). Two for RELAX NG and one for XML Schema, and none for DTD. Been twiddling sitemap.xmap (and forrest.xmap) and cocoon.xconf files. Trying to specify a grammar for the particular use in the sitemap match, then requesting the validation report gives Unsupported grammar language. Not specifying a grammar, then requesting the validation report gives The markup in the document preceding the root element must be well-formed The logs show that the DTD has been resolved by the catalog entity resolver. There is a message for Detecting grammar for the DTD, but no resolution message for detected for schema like there is for RNG validation. Then we get the error message for markup as above, a SAXParseException. This line of the DTD is the first !ENTITY ... declaration. So it is not parsing it as a DTD. Note that Forrest still uses Cocoon-2.1 but IIRC then this Validation block is the same. Need to look at the Cocoon Samples. Perhaps there is a reason that Pier did provide a DTD sample in the beginning. Typo: did *not* provide a DTD sample Another thought: I wonder if this is because our xml-parser is configured in cocoon.xconf to have validate=false. -David 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
Re: Does ValidatingTransformer support DTD validation
Robby Pelssers wrote: Hi David, One thing I still need to investigate was Jeroen's reply: 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 I checked that (probably somewhat deprecated) documentation but i noticed something that could be usefull: map:transform type='validate' src='validation/xhtml1-transitional.dtd' map:parameter name='active' value='true'/ !-- this part -- /map:transform If i find some time this week I will check if setting that 'active' parameter to true does any good unless you beat me to it ;-) This is a different component to the Transformer that is in Cocoon SVN. -David
Re: Does ValidatingTransformer support DTD validation
Robby Pelssers wrote: i am trying to use the validating transformer with a DTD but can't get it to work. IIRC when i set this up for Apache Forrest a while back, then i could not get DTD validation working either. So we converted the DTD to RELAX NG using Trang. Some of the notes and links here might help: http://forrest.apache.org/howto-dev.html#debug-validation https://issues.apache.org/jira/browse/FOR-1172 (I have been trying to investigate this for ages. Sorry, not much time, so i hope this much helps.) No matter what i do to configure the transformer, there are only three default grammar for SchemaParser instantiated (DEBUG messages in core.log). Two for RELAX NG and one for XML Schema, and none for DTD. Been twiddling sitemap.xmap (and forrest.xmap) and cocoon.xconf files. Trying to specify a grammar for the particular use in the sitemap match, then requesting the validation report gives Unsupported grammar language. Not specifying a grammar, then requesting the validation report gives The markup in the document preceding the root element must be well-formed The logs show that the DTD has been resolved by the catalog entity resolver. There is a message for Detecting grammar for the DTD, but no resolution message for detected for schema like there is for RNG validation. Then we get the error message for markup as above, a SAXParseException. This line of the DTD is the first !ENTITY ... declaration. So it is not parsing it as a DTD. Note that Forrest still uses Cocoon-2.1 but IIRC then this Validation block is the same. Need to look at the Cocoon Samples. Perhaps there is a reason that Pier did provide a DTD sample in the beginning. Another thought: I wonder if this is because our xml-parser is configured in cocoon.xconf to have validate=false. -David 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
Re: Does ValidatingTransformer support DTD validation
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.pelss...@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