Resending as text instead of html, per request from David Crossley.
Apologies -- I don't remember why I thought the HTML formatting was
important.
Hello,
A couple of years ago I asked for help getting DTD validation to work
with Cocoon 2.1.8.
I got some information but it didn't solve the problem, and I was left
with "try looking through the code or running in a debugger".
That exchange is included below.[1]
The same error occurs in 2.1.11 when I try to validate with a DTD.
The codebase is too large for me to analyze... especially for a
framework that is supposed to be usable "often without any required
programming." I've tried running Cocoon in a debugger but have been
unsuccessful.
Others have asked about DTD validation. E.g. [2]. But apparently no
results were forthcoming.
This is really surprising to me, given that Cocoon is built around XML
pipelines, and DTD is the only kind of schema language defined as part
of the XML standard.
Granted, XML Schema is more powerful, and more modern. But for our
simple needs, and I'm sure others' too, XML Schema is like using
Mathematica to compute 2 + 2. DTD expresses the grammar much more
efficiently, for the simple cases. (For corner cases, we use Schematron,
which we are able to make work manually because it only requires XML and
XSLT, which Cocoon handles well.)
I'm all for supporting XML Schema and Relax NG, but for Cocoon not to
support DTD's at all just seems baffling.
Can any of you Cocoon developers take a look at this please?
Unfortunately, we're pretty well tied to Cocoon 2.1.* for now... 2.2
seems to be too big of a structural change for our code base, and 3.0
all the more so.
I realize some will be less than motivated to integrate this into the
older 2.1.* branch.
But we have a lot of time and code invested in Cocoon 2.1, so I thought
it was worth asking.
At the very least, if someone could tell me authoritatively "no, this is
not supported in Cocoon", then I could prune one branch of the search
for solutions.
Back in 2005, Pier Fumagali wrote
(http://www.mail-archive.com/[email protected]/msg34587.html)
This finishes the "validation" block and its implementation. It
provides two transformers: one filtering in-line and failing on
errors, and one producing a report.
Relax-NG is implemented using Jing.
XML-Schema is implemented using the JAXP API supplied with Cocoon ...
DTD is currently not supported, although it would be trivial to do it
with the Xerces supplied with Cocoon.
I would love to know whether this ever happened... or if not, how to
supply the trivial missing piece to make it happen.
Regards,
Lars
[1]
http://markmail.org/message/4jx72f3ngzbuyxze#query:cocoon%20validation-report%20dtd+page:1+mid:4jx72f3ngzbuyxze+state:results
Subject: Re: *DTD* validation: "Unsupported grammar language"Link to
this message <http://markmail.org/message/4jx72f3ngzbuyxze>
From: Joerg Heinicke ([EMAIL PROTECTED])
Date: 12/20/2006 04:09:49 PM
List: org.apache.*cocoon*.dev
just from having a look at the code: 1. It's
http://www.w3.org/TR/REC-xml (see Validator interface and its declared
constants). 2. This exception is thrown in
AbstractValidator.getValidationHandler() in line 327 in the current
code. It is thrown when no SchemaParser can be found. 3. Grammars and
their parsers seem to be configured via Configurable.configure(). So
maybe the javadoc for this method [1] is helpful. Otherwise you might
need to have a look into the code of this method or do some debugging.
Regards Jörg
[1]
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/validation/jaxp/JaxpSchemaParser.html#configure(org.apache.avalon.framework.configuration.Configuration)
On 19.12.2006 18:32, Lars Huttar wrote:
Hello, I seconded this question on the *Cocoon* user list but have not
received a response, so would like to ask the developers. In *Cocoon*
2.1.9, we are trying to use ValidationReportTransformer to validate our
XML against a *DTD*. I'm looking at the documentation at
http://cocoon.zones.apache.org/daisy/documentation/864/validation.html
and
http://cocoon.zones.apache.org/daisy/documentation/components/1058/g2/691.html.
The validation sample block has examples for validating against RNG and
XML Schema, but not against a *DTD*. Like José quoted below, I'm trying
to figure out how to make it work. Here's my attempt, a copy-and-modify
of a match pattern in samples\blocks\validation\sitemap.xmap:
<map:match pattern="report-*dtd*-valid">
<map:generate src="source-ok.xml"/>
<map:transform type="*validation-report*" src="schema-ok.*dtd*">
<map:parameter name="grammar" value="http://www.w3.org/TR/REC-xml" />
</map:transform>
<map:transform src="context:/stylesheets/system/xml2html.xslt"/>
<map:serialize/>
</map:match>
I added the "grammar" parameter, as instructed by the documentation
referenced above, to the *validation-report* transformer. For grammar
identifier, the documentation seemed to indicate I should use
"http://www.w3.org/TR/REC-xml". (I also tried "*dtd*" just for kicks.)
But the result is that I get the error
org.apache.*cocoon*.components.validation.ValidatorException:
Unsupported grammar languagehttp://www.w3.org/TR/REC-xml
Does this mean there is no support for validating against DTDs? Or am I
doing something wrong?
Thanks, Lars