You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by pi...@apache.org on 2005/09/13 01:48:40 UTC

svn commit: r280450 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/validation: conf/ java/org/apache/cocoon/components/validation/ java/org/apache/cocoon/components/validation/impl/ java/org/apache/cocoon/transformation/ samples/

Author: pier
Date: Mon Sep 12 16:48:31 2005
New Revision: 280450

URL: http://svn.apache.org/viewcvs?rev=280450&view=rev
Log:
Implemented ValidationReportTransformer producing a report of the validation.
Updated samples to show output of validation report.

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/ValidationReportTransformer.java
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/Validator.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/impl/AbstractValidator.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xmap?rev=280450&r1=280449&r2=280450&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xmap Mon Sep 12 16:48:31 2005
@@ -19,11 +19,11 @@
       xpath="/sitemap/components/transformers"
       unless="transformer[@name='validate']">
 
-    <map:transformer name="validate"
-                     logger="sitemap.transformer.validate"
-                     src="org.apache.cocoon.transformation.ValidatingTransformer">
-
-      <!--+ The "grammar" an optional configuration element specifying the default
+  <map:transformer name="validate"
+    logger="sitemap.transformer.validate"
+    src="org.apache.cocoon.transformation.ValidatingTransformer">
+    
+    <!--+ The "grammar" an optional configuration element specifying the default
           | grammar used by the validator. When the "grammar" element is specified,
           | the automatic detection of schema types will be disabled.
           |
@@ -33,7 +33,24 @@
           | For a list of well known grammars, see the JavaDoc documentation for the
           | org.apache.cocoon.components.validation.Validator interface.
           +-->
-      <!-- <grammar>... grammar identifier ...</grammar> -->
-    </map:transformer>
+    <!-- <grammar>... grammar identifier ...</grammar> -->
+  </map:transformer>
 
+  <map:transformer name="validation-report"
+    logger="sitemap.transformer.validate"
+    src="org.apache.cocoon.transformation.ValidationReportTransformer">
+    
+    <!--+ The "grammar" an optional configuration element specifying the default
+          | grammar used by the validator. When the "grammar" element is specified,
+          | the automatic detection of schema types will be disabled.
+          |
+          | This can also be specifed in pipelines as a parameter:
+          |   <map:parameter name="grammar" value="... grammar identifier ..."/>
+          |
+          | For a list of well known grammars, see the JavaDoc documentation for the
+          | org.apache.cocoon.components.validation.Validator interface.
+          +-->
+    <!-- <grammar>... grammar identifier ...</grammar> -->
+  </map:transformer>
+  
 </xmap>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/Validator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/Validator.java?rev=280450&r1=280449&r2=280450&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/Validator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/Validator.java Mon Sep 12 16:48:31 2005
@@ -38,13 +38,16 @@
  * <p>Assuming that two different {@link SchemaParser}s called <code>first</code>
  * and <code>second</code> are both able to understand the
  * {@link #GRAMMAR_RELAX_NG RELAX NG} grammar (identified by the
- * <code>http://relaxng.org/ns/structure/0.9</code> identifier) one could select
+ * <code>http://relaxng.org/ns/structure/1.0</code> identifier) one could select
  * between the two implementation using the following two strings:</p>
  * 
  * <ul>
- *   <li><code>first:http://relaxng.org/ns/structure/0.9</code></li>
- *   <li><code>second:http://relaxng.org/ns/structure/0.9</code></li>
+ *   <li><code>first:http://relaxng.org/ns/structure/1.0</code></li>
+ *   <li><code>second:http://relaxng.org/ns/structure/1.0</code></li>
  * </ul>
+ * 
+ * <p>As a rule (unless when this is impossible) the grammar identifier is
+ * equivalent to the namespace of the root element of a schema.</p>
  *
  * @author <a href="mailto:pier@betaversion.org">Pier Fumagalli</a>
  */

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/impl/AbstractValidator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/impl/AbstractValidator.java?rev=280450&r1=280449&r2=280450&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/impl/AbstractValidator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/components/validation/impl/AbstractValidator.java Mon Sep 12 16:48:31 2005
@@ -37,7 +37,6 @@
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
 
 /**
  * <p>The {@link AbstractValidator} provides a generic implementation of the methods
@@ -451,8 +450,6 @@
             throw new SAXException("Unable to access XML parser", exception);
         } catch (DetectionException exception) {
             grammar = exception.grammar;
-        } catch (SAXParseException exception) {
-            grammar = Validator.GRAMMAR_XML_DTD;
         } finally {
             if (xmlParser != null) this.manager.release(xmlParser);
         }

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/ValidationReportTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/ValidationReportTransformer.java?rev=280450&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/ValidationReportTransformer.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/ValidationReportTransformer.java Mon Sep 12 16:48:31 2005
@@ -0,0 +1,318 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.transformation;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.caching.CacheableProcessingComponent;
+import org.apache.cocoon.components.validation.ValidationHandler;
+import org.apache.cocoon.components.validation.Validator;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceValidity;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * <p>The {@link ValidationReportTransformer} provides a {@link Transformer}
+ * validating documents while being processed in a Cocoon pipeline, and preparing
+ * a report of all detected inconsistancies according the specified schema.</p>
+ * 
+ * <p>The only defined (but not required) configuration for this component is
+ * <code>&lt;grammar&gt;<i>...string...</i>&lt;/grammar&gt;</code>
+ * indicating the default grammar language of the schemas to use.</p>
+ * 
+ * <p>This configuration parameter can be overridden by specifying the
+ * <code>grammar</code> parameter when using this {@link Transformer} in a
+ * pipeline.</p>
+ * 
+ * <p>If no grammar is specified (either as a configuration, or a parameter) this
+ * transformer will instruct the {@link Validator} to try and guess the grammar
+ * of the schema being parsed.</p>
+ * 
+ * <p>The report prepared by this transformer will look like the following:</p>
+ * 
+ * <pre>
+ *   &lt;report xmlns="http://apache.org/cocoon/validation/1.0"&gt;
+ *     &lt;warning system="..." public="..." line="..." column="..."&gt;
+ *       ... detailed message ...
+ *     &lt;/warning&gt;
+ *     &lt;error system="..." public="..." line="..." column="..."&gt;
+ *       ... detailed message ...
+ *     &lt;/error&gt;
+ *     &lt;fatal system="..." public="..." line="..." column="..."&gt;
+ *       ... message ...
+ *     &lt;/fatal&gt;
+ *   &lt;/report&gt;
+ * </pre>
+ * 
+ * <p>The location attributes specified in the <code>&lt;warning/&gt;</code>,
+ * <code>&lt;error/&gt;</code> and <code>&lt;fatal/&gt;</code> tags are all optional
+ * and will be generated only if known.</p>
+ *
+ * @author <a href="mailto:pier@betaversion.org">Pier Fumagalli</a>
+ */
+public class ValidationReportTransformer extends AbstractTransformer
+implements Configurable, Serviceable, Disposable, CacheableProcessingComponent {
+    
+    /** <p>The configured {@link ServiceManager} instance.</p> */
+    private ServiceManager serviceManager = null;
+    /** <p>The configured {@link Validator} instance.</p> */
+    private Validator validator = null;
+    /** <p>The configured default grammar language.</p> */
+    private String grammar = null;
+
+    /** <p>The {@link Report} instance to be used while processing a request.</p> */
+    private Report report = null;
+    /** <p>The {@link ValidationHandler} to use in this transformation.</p> */
+    private ValidationHandler handler = null;
+    /** <p>The {@link XMLConsumer} to send the validation report to.</p> */
+    private XMLConsumer consumer = null;
+    /** <p>A unique key identifying the schema source for caching.</p> */
+    private String key = null;
+
+    /**
+     * <p>Create a new {@link ValidationReportTransformer} instance.</p>
+     */
+    public ValidationReportTransformer() {
+        super();
+    }
+
+    /**
+     * <p>Contextualize this component instance specifying its associated
+     * {@link ServiceManager} instance.</p>
+     * 
+     * @param manager the {@link ServiceManager} to associate with this component.
+     * @throws ServiceException if a dependancy of this could not be resolved.
+     */
+    public void service(ServiceManager manager)
+    throws ServiceException {
+        this.serviceManager = manager;
+        this.validator = (Validator) manager.lookup(Validator.ROLE);
+    }
+
+    /**
+     * <p>Configure this component instance.</p>
+     * 
+     * <p>The only defined (but not required) configuration for this component is
+     * <code>&lt;grammar&gt;<i>...string...</i>&lt;/grammar&gt;</code>
+     * indicating the default grammar used by this transformer used for parsing
+     * schemas.</p>
+     *
+     * @param configuration a {@link Configuration} instance for this component.
+     * @throws ConfigurationException never thrown.
+     */
+    public void configure(Configuration configuration)
+    throws ConfigurationException {
+        this.grammar = configuration.getChild("grammar").getValue(null);
+    }
+
+    /**
+     * <p>Dispose of this component instance releasing all previously acquired
+     * required instances back to the {@link ServiceManager}.</p>
+     */
+    public void dispose() {
+        this.serviceManager.release(this.validator);
+    }
+
+    /**
+     * <p>Contextualize this component in the scope of a pipeline when a request
+     * is processed.</p>
+     *
+     * @param resolver the {@link SourceResolver} contextualized in this request.
+     * @param objectModel unused.
+     * @param source the source URI of the schema to validate against.
+     * @param parameters unused.
+     */
+    public void setup(SourceResolver resolver, Map objectModel, String source,
+                      Parameters parameters)
+    throws ProcessingException, SAXException, IOException {
+        Source s = null;
+        try {
+            Report r = new Report();
+            String g = parameters.getParameter("grammar", this.grammar);
+            s = resolver.resolveURI(source);
+            if (g == null) {
+                this.handler = this.validator.getValidationHandler(s, r);
+            } else{
+                this.handler = this.validator.getValidationHandler(s, g, r);
+            }
+            this.setContentHandler(this.handler);
+            this.setLexicalHandler(this.handler);
+            this.report = r;
+        } finally {
+            if (source != null) resolver.release(s);
+        }
+    }
+
+    /**
+     * <p>Specify the {@link XMLConsumer} receiving SAX events emitted by this
+     * {@link Transformer} instance in the scope of a request.</p>
+     *
+     * @param consumer the {@link XMLConsumer} to send SAX events to.
+     */
+    public void setConsumer(XMLConsumer consumer) {
+        this.consumer = consumer;
+    }
+
+    /**
+     * <p>Receive notification of the end of the document and produce the report
+     * of the validation result.</p>
+     *
+     * @throws SAXException
+     * @see org.xml.sax.ContentHandler#endDocument()
+     */
+    public void endDocument()
+    throws SAXException {
+        super.endDocument();
+        this.report.generateReport(this.consumer);
+    }
+
+    /**
+     * <p>Return the unique key to associated with the schema being processed in
+     * the scope of the request being processed for caching.</p>
+     *
+     * @return a non null {@link String} representing the unique key for the schema.
+     */
+    public Serializable getKey() {
+        return this.key;
+    }
+
+    /**
+     * <p>Return the {@link SourceValidity} associated with the schema currently
+     * being processed in the scope of the request being processed.</p>
+     *
+     * @return a non null {@link SourceValidity} instance.
+     */
+    public SourceValidity getValidity() {
+        return this.handler.getValidity();
+    }
+
+    /**
+     * <p>Recycle this component instance at the end of request processing.</p>
+     */
+    public void recycle() {
+        this.consumer = null;
+        this.handler = null;
+        this.report = null;
+        this.key = null;
+        super.recycle();
+    }
+    
+    /**
+     * 
+     */
+    private static final class Report implements ErrorHandler {
+
+        private static final String NS = "http://apache.org/cocoon/validation/1.0";
+        private final List entries = new ArrayList();
+
+        public void warning(SAXParseException exception)
+        throws SAXException {
+            this.entries.add(new ReportEntry("warning", exception));
+        }
+
+        public void error(SAXParseException exception)
+        throws SAXException {
+            this.entries.add(new ReportEntry("error", exception));
+        }
+
+        public void fatalError(SAXParseException exception)
+        throws SAXException {
+            this.entries.add(new ReportEntry("fatal", exception));
+        }
+
+        private void generateReport(ContentHandler handler)
+        throws SAXException {
+            /* Start the report */
+            handler.startDocument();
+            handler.startPrefixMapping("", NS);
+            AttributesImpl attributes = new AttributesImpl();
+            handler.startElement(NS, "report", "report", attributes);
+
+            /* Each collected error will generate its own entry */
+            Iterator iterator = this.entries.iterator();
+            while(iterator.hasNext()) {
+                ReportEntry entry = (ReportEntry) iterator.next();
+                attributes.clear();
+
+                if (entry.exception.getPublicId() != null) {
+                    if (! "".equals(entry.exception.getPublicId())) {
+                        attributes.addAttribute("", "public", "public", "CDATA",
+                                                entry.exception.getPublicId());
+                    }
+                }
+
+                if (entry.exception.getSystemId() != null) {
+                    if (! "".equals(entry.exception.getSystemId())) {
+                        attributes.addAttribute("", "system", "system", "CDATA",
+                                                entry.exception.getSystemId());
+                    }
+                }
+
+                if (entry.exception.getLineNumber() >= 0) {
+                    String l = Integer.toString(entry.exception.getLineNumber());
+                    attributes.addAttribute("", "line", "line", "CDATA", l);
+                }
+
+                if (entry.exception.getColumnNumber() >= 0) {
+                    String c = Integer.toString(entry.exception.getColumnNumber());
+                    attributes.addAttribute("", "column", "column", "CDATA", c);
+                }
+                
+                String level = entry.level;
+                handler.startElement(NS, level, level, attributes);
+                char message[] = entry.exception.getMessage().toCharArray();
+                handler.characters(message, 0, message.length);
+                handler.endElement(NS, level, level);
+            }
+
+            /* After all the exceptions have been dumped, close the report */
+            handler.endElement(NS, "report", "report");
+            handler.endPrefixMapping("");
+            handler.endDocument();
+        }
+    }
+
+    private static final class ReportEntry {
+        
+        private final String level;
+        private final SAXParseException exception;
+        
+        private ReportEntry(String level, SAXParseException exception) {
+            this.level = level;
+            this.exception = exception;
+        }
+    }
+}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap?rev=280450&r1=280449&r2=280450&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap Mon Sep 12 16:48:31 2005
@@ -39,34 +39,78 @@
       </map:match>
 
       <!-- relax ng samples -->
-      <map:match pattern="validate-valid">
+      <map:match pattern="validate-rng-valid">
         <map:generate src="source-ok.xml"/>
         <map:transform type="validate" src="schema-ok.rng"/>
         <map:transform src="validation.xslt"/>
         <map:serialize/>
       </map:match>
-
-      <map:match pattern="validate-invalid">
+      
+      <map:match pattern="validate-rng-invalid">
         <map:generate src="source-no.xml"/>
         <map:transform type="validate" src="schema-ok.rng"/>
         <map:transform src="validation.xslt"/>
         <map:serialize/>
       </map:match>
-
-      <map:match pattern="validate-badschema">
+      
+      <map:match pattern="validate-rng-badschema">
         <map:generate src="source-ok.xml"/>
         <map:transform type="validate" src="schema-no.rng"/>
         <map:transform src="validation.xslt"/>
         <map:serialize/>
       </map:match>
       
-      <map:match pattern="validate-noschema">
+      <!-- xml schema samples -->
+      <map:match pattern="validate-xsd-valid">
         <map:generate src="source-ok.xml"/>
-        <map:transform type="validate" src="schema-unavailable.rng"/>
+        <map:transform type="validate" src="schema-ok.xsd"/>
         <map:transform src="validation.xslt"/>
         <map:serialize/>
       </map:match>
+      
+      <map:match pattern="validate-xsd-invalid">
+        <map:generate src="source-no.xml"/>
+        <map:transform type="validate" src="schema-ok.xsd"/>
+        <map:transform src="validation.xslt"/>
+        <map:serialize/>
+      </map:match>
+      
+      <map:match pattern="validate-xsd-badschema">
+        <map:generate src="source-ok.xml"/>
+        <map:transform type="validate" src="schema-no.xsd"/>
+        <map:transform src="validation.xslt"/>
+        <map:serialize/>
+      </map:match>
+
+      <!-- reporting samples -->
+      <map:match pattern="report-rng-invalid">
+        <map:generate src="source-no.xml"/>
+        <map:transform type="validation-report" src="schema-ok.rng"/>
+        <map:transform src="context:/stylesheets/system/xml2html.xslt"/>
+        <map:serialize/>
+      </map:match>
+      
+      <map:match pattern="report-xsd-invalid">
+        <map:generate src="source-no.xml"/>
+        <map:transform type="validation-report" src="schema-ok.xsd"/>
+        <map:transform src="context:/stylesheets/system/xml2html.xslt"/>
+        <map:serialize/>
+      </map:match>
 
+      <map:match pattern="report-rng-valid">
+        <map:generate src="source-ok.xml"/>
+        <map:transform type="validation-report" src="schema-ok.rng"/>
+        <map:transform src="context:/stylesheets/system/xml2html.xslt"/>
+        <map:serialize/>
+      </map:match>
+      
+      <map:match pattern="report-xsd-valid">
+        <map:generate src="source-ok.xml"/>
+        <map:transform type="validation-report" src="schema-ok.xsd"/>
+        <map:transform src="context:/stylesheets/system/xml2html.xslt"/>
+        <map:serialize/>
+      </map:match>
+      
     </map:pipeline>
   </map:pipelines>
 </map:sitemap>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml?rev=280450&r1=280449&r2=280450&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml Mon Sep 12 16:48:31 2005
@@ -24,21 +24,45 @@
     <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
   </group>
 
-  <group name="ValidatingTransformer Samples">
-    <sample name="Successful validation" href="validate-valid">
+  <group name="ValidatingTransformer (Relax-NG) Samples">
+    <sample name="Successful validation" href="validate-rng-valid">
       Shows the output of a pipeline with a valid document being processed.
     </sample>
-    <sample name="Validation failure" href="validate-invalid">
+    <sample name="Validation failure" href="validate-rng-invalid">
       Shows the output of a pipeline with an invalid document being processed.
     </sample>
-    <sample name="Non-existent schema failure" href="validate-noschema">
-      Shows the output of a pipeline configured with a non-existent schema.
-    </sample>
-    <sample name="Schema parsing failure" href="validate-badschema">
+    <sample name="Schema parsing failure" href="validate-rng-badschema">
       Shows the output of a pipeline configured with an invalid schema.
     </sample>
   </group>
   
+  <group name="ValidatingTransformer (XML-Schema) Samples">
+    <sample name="Successful validation" href="validate-xsd-valid">
+      Shows the output of a pipeline with a valid document being processed.
+    </sample>
+    <sample name="Validation failure" href="validate-xsd-invalid">
+      Shows the output of a pipeline with an invalid document being processed.
+    </sample>
+    <sample name="Schema parsing failure" href="validate-xsd-badschema">
+      Shows the output of a pipeline configured with an invalid schema.
+    </sample>
+  </group>
+
+  <group name="ValidationReportTransformer Samples">
+    <sample name="Invalid Relax-NG report" href="report-rng-invalid">
+      Shows the output of a report produced using the Relax-NG grammar for an invalid source.
+    </sample>
+    <sample name="Invalid XML-Schema report" href="report-xsd-invalid">
+      Shows the output of a report produced using the XML-Schema grammar for an invalid source.
+    </sample>
+    <sample name="Valid Relax-NG report" href="report-rng-valid">
+      Shows the output of a report produced using the Relax-NG grammar for a valid source.
+    </sample>
+    <sample name="Valid XML-Schema report" href="report-xsd-valid">
+      Shows the output of a report produced using the XML-Schema grammar for a valid source.
+    </sample>
+  </group>
+
   <group name="Avaliable Documentation">
     <sample name="Validation Block Documentation"
             href="http://cocoon.zones.apache.org/daisy/documentation/blocks/validation.html">



Re: Validation block finished (Was: Re: svn commit: r280450 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/validation: conf/ java/org/apache/cocoon/components/validation/ java/org/apache/cocoon/components/validation/impl/ java/org/apache/cocoon/transformation/ samples/)

Posted by Pier Fumagalli <pi...@betaversion.org>.
On 13 Sep 2005, at 02:14, Vadim Gritsenko wrote:
> Pier Fumagalli wrote:
>
>> On 13 Sep 2005, at 00:48, pier@apache.org wrote:
>> There might be some bugs (as always with my code), but as I need  
>> to  use those in production, if one comes along, I'll be likely to  
>> be the  first one to spot it... As far as I can see, for now,  
>> everything works.
>
> Can you please make up your mind, is it DEBUG or WARN??? In several  
> places:
>
> > +     if (this.logger.isDebugEnabled()) {
> > +         this.logger.warn("...");
> > +     }
>
> :-P

Twice, only twice! :-D

     Pier


Re: Validation block finished (Was: Re: svn commit: r280450 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/validation: conf/ java/org/apache/cocoon/components/validation/ java/org/apache/cocoon/components/validation/impl/ java/org/apache/cocoon/transformation/ samples/)

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Pier Fumagalli wrote:
> On 13 Sep 2005, at 00:48, pier@apache.org wrote:
> 
> There might be some bugs (as always with my code), but as I need to  use 
> those in production, if one comes along, I'll be likely to be the  first 
> one to spot it... As far as I can see, for now, everything works.

Can you please make up your mind, is it DEBUG or WARN??? In several places:

 > +     if (this.logger.isDebugEnabled()) {
 > +         this.logger.warn("...");
 > +     }


:-P

Vadim

Validation block finished (Was: Re: svn commit: r280450 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/validation: conf/ java/org/apache/cocoon/components/validation/ java/org/apache/cocoon/components/validation/impl/ java/org/apache/cocoon/transformation/ samples/)

Posted by Pier Fumagalli <pi...@betaversion.org>.
On 13 Sep 2005, at 00:48, pier@apache.org wrote:

> Author: pier
> Date: Mon Sep 12 16:48:31 2005
> New Revision: 280450
>
> URL: http://svn.apache.org/viewcvs?rev=280450&view=rev
> Log:
> Implemented ValidationReportTransformer producing a report of the  
> validation.
> Updated samples to show output of validation report.

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  
(Gianugo, you can write your little Schematron factory and contribute  
it here, riiiight? :-)

DTD is currently not supported, although it would be trivial to do it  
with the Xerces supplied with Cocoon.

MSV can't be enabled (I have a schema parser, but we have lincensing  
problems). One day, when I get some time to write some mock classes,  
I might contribute it (for now, xmlschema and relax - i think - are  
enough).

Will the people interested in validation (read Gianugo and Andreas)  
take a look at the API and tell me if there's something else they  
need???

If I don't hear from you, I'll finish up the Daisy-based  
documentation and mark the block as "stable" (as we're not going to  
expect API changes).

There might be some bugs (as always with my code), but as I need to  
use those in production, if one comes along, I'll be likely to be the  
first one to spot it... As far as I can see, for now, everything works.

     Pier