cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Huttar <>
Subject DTD validation
Date Thu, 04 Sep 2008 19:07:19 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body bgcolor="#cccccc" text="#000000">
A couple of years ago I asked for help getting DTD validation to work
with Cocoon 2.1.8.<br>
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".<br>
That exchange is included below.[1]<br>
The same error occurs in 2.1.11 when I try to validate with a DTD.<br>
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.<br>
Others have asked about DTD validation. E.g. [2]. But apparently no
results were forthcoming.<br>
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.<br>
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.)<br>
I'm all for supporting XML Schema and Relax NG, but for Cocoon not to
support DTD's at all just seems baffling.<br>
Can any of you Cocoon developers take a look at this please?<br>
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.<br>
I realize some will be less than motivated to integrate this into the
older 2.1.* branch.<br>
But we have a lot of time and code invested in Cocoon 2.1, so I thought
it was worth asking.<br>
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.<br>
Back in 2005, Pier Fumagali wrote
(<a class="moz-txt-link-freetext" href=""></a>)<br>
<blockquote type="cite"><tt>This finishes the "validation" block and
its implementation. It </tt><tt>provides two transformers: one
filtering in-line and failing on </tt><tt>errors, and one producing a
  <pre style="margin: 0em;">Relax-NG is implemented using Jing.

  <tt>XML-Schema is implemented using the JAXP API supplied with Cocoon
  </tt><tt>... </tt><tt>DTD is currently not supported, although it
would be trivial to do it </tt><tt>with the Xerces supplied with
I would love to know whether this ever happened... or if not, how to
supply the trivial missing piece to make it happen.<br>
<a class="moz-txt-link-freetext" href=""></a><br>
<table id="headers">
    <tr class="subject">
      <td>Re: <strong>DTD</strong> validation: "Unsupported grammar
language"<a class="permalink"
 title="Use this link to share or bookmark this message"
 alt="Link to this message"></a></td>
    <tr class="from">
      <td>Joerg Heinicke (<span>joer<a class="email">...</a></span>)</td>
    <tr class="date">
      <td>12/20/2006 04:09:49 PM</td>
    <tr class="list">
<div id="body" class="messagebody">
<div class="pws">
<p>just from having a look at the code:
1. It's <a class="exlink" href=""
 rel="nofollow"></a> (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.
<p>[1] <br>
<a class="exlink"
<p>On 19.12.2006 18:32, Lars Huttar wrote:
<div class="quote quote-1">
I seconded this question on the <strong>Cocoon</strong> user list but
have not received a response, so would like to ask the developers.
In <strong>Cocoon</strong> 2.1.9, we are trying to use
ValidationReportTransformer to validate our XML against a <strong>DTD</strong>.
I'm looking at the documentation at <a class="exlink"
and <a class="exlink"
<p>The validation sample block has examples for validating against RNG
and XML Schema, but not against a <strong>DTD</strong>.
Like Jos&eacute; 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
&lt;map:match pattern="report-<strong>dtd</strong>-valid"&gt;<br>
&nbsp; &lt;map:generate src="source-ok.xml"/&gt;<br>
&nbsp; &lt;map:transform type="<strong>validation-report</strong>"
&nbsp;&nbsp;&nbsp; &lt;map:parameter name="grammar" value="<a class="exlink"
 href="" rel="nofollow"></a>"
&nbsp; &lt;/map:transform&gt; <br>
&nbsp; &lt;map:transform
src="context:/stylesheets/system/xml2html.xslt"/&gt; <br>
&nbsp; &lt;map:serialize/&gt; <br>
<p>I added the "grammar" parameter, as instructed by the documentation
referenced above, to the <strong>validation-report</strong>
For grammar identifier, the documentation seemed to indicate I should
use "<a class="exlink" href=""
 rel="nofollow"></a>". (I also tried "<strong>dtd</strong>"
just for kicks.)
But the result is that I get the error org.apache.<strong>cocoon</strong>.components.validation.ValidatorException:
Unsupported grammar language
<p>Does this mean there is no support for validating against DTDs? Or
am I doing something wrong?

View raw message