cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Huttar <lars_hut...@sil.org>
Subject DTD validation
Date Thu, 04 Sep 2008 19:07:19 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#cccccc" text="#000000">
Hello,<br>
<br>
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>
<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>
<br>
Others have asked about DTD validation. E.g. [2]. But apparently no
results were forthcoming.<br>
<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>
<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>
<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>
<br>
Can any of you Cocoon developers take a look at this please?<br>
<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>
<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>
<br>
Back in 2005, Pier Fumagali wrote
(<a class="moz-txt-link-freetext" href="http://www.mail-archive.com/dev@cocoon.apache.org/msg34587.html">http://www.mail-archive.com/dev@cocoon.apache.org/msg34587.html</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
report.
  </tt>
  <pre style="margin: 0em;">Relax-NG is implemented using Jing.

  </pre>
  <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
Cocoon.
  </tt></blockquote>
I would love to know whether this ever happened... or if not, how to
supply the trivial missing piece to make it happen.<br>
<br>
<br>
Regards,<br>
Lars<br>
<br>
<br>
[1]<br>
<a class="moz-txt-link-freetext" href="http://markmail.org/message/4jx72f3ngzbuyxze#query:cocoon%20validation-report%20dtd+page:1+mid:4jx72f3ngzbuyxze+state:results">http://markmail.org/message/4jx72f3ngzbuyxze#query:cocoon%20validation-report%20dtd+page:1+mid:4jx72f3ngzbuyxze+state:results</a><br>
<br>
<br>
<br>
<table id="headers">
  <tbody>
    <tr class="subject">
      <th>Subject:</th>
      <td>Re: <strong>DTD</strong> validation: "Unsupported grammar
language"<a class="permalink"
 href="http://markmail.org/message/4jx72f3ngzbuyxze"><img
 src="cid:part1.03020700.00090604@sil.org"
 title="Use this link to share or bookmark this message"
 alt="Link to this message"></a></td>
    </tr>
    <tr class="from">
      <th>From:</th>
      <td>Joerg Heinicke (<span>joer<a class="email">...</a>@gmx.de</span>)</td>
    </tr>
    <tr class="date">
      <th>Date:</th>
      <td>12/20/2006 04:09:49 PM</td>
    </tr>
    <tr class="list">
      <th>List:</th>
      <td><span>org.apache.<strong>cocoon</strong>.dev</span></td>
    </tr>
  </tbody>
</table>
<div id="body" class="messagebody">
<div class="pws">
<p>just from having a look at the code:
1. It's <a class="exlink" href="http://www.w3.org/TR/REC-xml"
 rel="nofollow">http://www.w3.org/TR/REC-xml</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>
<p>Regards
J&ouml;rg
</p>
<p>[1] <br>
<a class="exlink"
 href="http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/validation/jaxp/JaxpSchemaParser.html#configure"
 rel="nofollow">http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/validation/jaxp/JaxpSchemaParser.html#configure</a>(org.apache.avalon.framework.configuration.Configuration)
</p>
<p>On 19.12.2006 18:32, Lars Huttar wrote:
</p>
<div class="quote quote-1">
<p>Hello,
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"
 href="http://cocoon.zones.apache.org/daisy/documentation/864/validation.html"
 rel="nofollow">http://cocoon.zones.apache.org/daisy/documentation/864/validation.html</a>
and <a class="exlink"
 href="http://cocoon.zones.apache.org/daisy/documentation/components/1058/g2/691.html"
 rel="nofollow">http://cocoon.zones.apache.org/daisy/documentation/components/1058/g2/691.html</a>.
</p>
<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
samples\blocks\validation\sitemap.xmap:<br>
&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>"
src="schema-ok.<strong>dtd</strong>"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;map:parameter name="grammar" value="<a class="exlink"
 href="http://www.w3.org/TR/REC-xml" rel="nofollow">http://www.w3.org/TR/REC-xml</a>"
/&gt;<br>
&nbsp; &lt;/map:transform&gt; <br>
&nbsp; &lt;map:transform
src="context:/stylesheets/system/xml2html.xslt"/&gt; <br>
&nbsp; &lt;map:serialize/&gt; <br>
&lt;/map:match&gt;
</p>
<p>I added the "grammar" parameter, as instructed by the documentation
referenced above, to the <strong>validation-report</strong>
transformer.
For grammar identifier, the documentation seemed to indicate I should
use "<a class="exlink" href="http://www.w3.org/TR/REC-xml"
 rel="nofollow">http://www.w3.org/TR/REC-xml</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 languagehttp://www.w3.org/TR/REC-xml
</p>
<p>Does this mean there is no support for validating against DTDs? Or
am I doing something wrong?
</p>
<p>Thanks,
Lars
</p>
</div>
<p></p>
</div>
</div>
</body>
</html>

Mime
View raw message