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/01 18:56:54 UTC

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

Author: pier
Date: Thu Sep  1 09:56:46 2005
New Revision: 265754

URL: http://svn.apache.org/viewcvs?rev=265754&view=rev
Log:
Removing some System.err.println leftovers. Added samples and configurations.

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/jing-transformer.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xsamples
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-no.rng
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-ok.rng
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-no.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-ok.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/JingTransformer.java

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/jing-transformer.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/jing-transformer.xmap?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/jing-transformer.xmap (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/jing-transformer.xmap Thu Sep  1 09:56:46 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<xmap xpath="/sitemap/components/transformers"
+      unless="generator[@name='jing']">
+
+    <map:transformer name="jing"
+                     logger="sitemap.transformer.jing"
+                     src="org.apache.cocoon.transformation.JingTransformer">
+      <!--+ The enable-caching configuration element is optional
+          | (defaults to true) and defines whether compiled RelaxNG
+          | schemas should be stored in Cocoon's transient cache or not
+          +-->
+      <!-- <enable-caching>true</enable-caching> -->
+    </map:transformer>
+</xmap>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xsamples
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xsamples?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xsamples (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/conf/validation.xsamples Thu Sep  1 09:56:46 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<xsamples xpath="/samples" unless="group[@name='VALIDATION']">
+
+  <group name="VALIDATION">
+    <sample name="VALIDATION Block" href="validation/">
+      Example usages of XML Validation.
+    </sample>
+  </group>
+
+</xsamples>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/JingTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/JingTransformer.java?rev=265754&r1=265753&r2=265754&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/JingTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/java/org/apache/cocoon/transformation/JingTransformer.java Thu Sep  1 09:56:46 2005
@@ -235,6 +235,7 @@
     public void recycle() {
         this.parsedSourceStack.clear();
         this.validationHandler = null;
+        this.uniqueIdentifier = null;
         this.sourceResolver = null;
         this.sourceValidity = null;
         this.inputSource = null;
@@ -280,7 +281,6 @@
     public InputSource resolveEntity(String publicId, String systemId)
     throws SAXException, IOException {
         if (this.sourceResolver == null) throw new IllegalStateException();
-        System.err.println("RESOLVING: " + systemId);
 
         /* Try to resolve the public id if we don't have a system id */
         if (systemId == null) {
@@ -295,9 +295,7 @@
         /* Use Cocoon's SourceResolver to resolve the system id */
         InputSource parsing = (InputSource) this.parsedSourceStack.peek();
         String base = parsing != null? parsing.getSystemId(): null;
-        System.err.println("BASE URI:  " + base);
         Source source = this.sourceResolver.resolveURI(systemId, base, null);
-        System.err.println("RESOLVED:  " + source.getURI());
         try {
             this.sourceValidity.add(source.getValidity());
             InputSource inputSource = new InputSource();

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-no.rng
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-no.rng?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-no.rng (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-no.rng Thu Sep  1 09:56:46 2005
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+  <define name="page">
+    <element name="page">
+      <this-invalidates-the-schema/>
+    </element>
+  </define>
+  <start>
+    <ref name="page"/>
+  </start>
+</grammar>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-ok.rng
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-ok.rng?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-ok.rng (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/schema-ok.rng Thu Sep  1 09:56:46 2005
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+  <define name="page">
+    <element name="page">
+      <empty/>
+    </element>
+  </define>
+  <start>
+    <ref name="page"/>
+  </start>
+</grammar>

Added: 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=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/sitemap.xmap Thu Sep  1 09:56:46 2005
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!--+
+    | HTML block samples sitemap
+    | CVS $Id: sitemap.xmap 230598 2005-08-06 21:53:09Z antonio $
+    +-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:pipelines>
+    <map:pipeline type="caching">
+
+      <map:match pattern="">
+        <map:redirect-to uri="welcome"/>
+      </map:match>
+
+      <!-- list of samples -->
+      <map:match pattern="welcome">
+        <map:generate src="welcome.xml"/>
+        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+          <map:parameter name="contextPath" value="{request:contextPath}"/>
+        </map:transform>
+        <map:serialize/>
+      </map:match>
+
+      <map:match pattern="jing-transformer-ok">
+        <map:generate src="source-ok.xml"/>
+        <map:transform type="jing" src="schema-ok.rng"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <map:match pattern="jing-transformer-invalid">
+        <map:generate src="source-no.xml"/>
+        <map:transform type="jing" src="schema-ok.rng"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <map:match pattern="jing-transformer-noschema">
+        <map:generate src="source-ok.xml"/>
+        <map:transform type="jing" src="schema-no.rng"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-no.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-no.xml?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-no.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-no.xml Thu Sep  1 09:56:46 2005
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page><this-is-an-invalid-element/></page>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-ok.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-ok.xml?rev=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-ok.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/source-ok.xml Thu Sep  1 09:56:46 2005
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<page/>

Added: 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=265754&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/validation/samples/welcome.xml Thu Sep  1 09:56:46 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!-- CVS $Id: samples.xml 230598 2005-08-06 21:53:09Z antonio $ -->
+
+<samples name="HTML Block Samples" xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <group name="Back">
+    <sample name="Back" href="../..">to Cocoon Samples main page</sample>
+    <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
+  </group>
+
+  <group name="JING Transformer">
+    <sample name="Successful validation" href="jing-transformer-ok">
+      Shows the output of a pipeline with a valid document being processed.
+    </sample>
+    <sample name="Validation failure" href="jing-transformer-invalid">
+      Shows the output of a pipeline with an invalid document being processed.
+    </sample>
+    <sample name="Schema parsing failure" href="jing-transformer-noschema">
+      Shows the output of a pipeline configured with a wrong schema.
+    </sample>
+  </group>
+
+</samples>