Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 68448 invoked from network); 1 Nov 2004 17:25:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Nov 2004 17:25:08 -0000 Received: (qmail 42214 invoked by uid 500); 1 Nov 2004 17:24:51 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 42080 invoked by uid 500); 1 Nov 2004 17:24:49 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 41940 invoked by uid 99); 1 Nov 2004 17:24:48 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 01 Nov 2004 09:24:47 -0800 Received: (qmail 68285 invoked by uid 65534); 1 Nov 2004 17:24:45 -0000 Date: 1 Nov 2004 17:24:45 -0000 Message-ID: <20041101172445.68280.qmail@minotaur.apache.org> From: tim@apache.org To: cvs@cocoon.apache.org Subject: svn commit: rev 56256 - cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: tim Date: Mon Nov 1 09:24:43 2004 New Revision: 56256 Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Log: For the FormsTransformer remove output of fi:choose, fi:struct, and fi:union elements (not used by the stylesheets), and prevent ft:case and ft:when from slipping into the output. Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java ============================================================================== --- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java (original) +++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Mon Nov 1 09:24:43 2004 @@ -97,6 +97,7 @@ private final DocHandler docHandler = new DocHandler(); private final FormHandler formHandler = new FormHandler(); private final NestedHandler nestedHandler = new NestedHandler(); + private final SkipHandler skipHandler = new SkipHandler(); private final WidgetLabelHandler widgetLabelHandler = new WidgetLabelHandler(); private final WidgetHandler widgetHandler = new WidgetHandler(); private final RepeaterSizeHandler repeaterSizeHandler = new RepeaterSizeHandler(); @@ -361,6 +362,22 @@ } } + protected class SkipHandler extends Handler { + public Handler process() throws SAXException { + switch(event) { + case EVENT_START_ELEMENT: + return this; + case EVENT_ELEMENT: + return nestedTemplate(); + case EVENT_END_ELEMENT: + return this; + default: + out.copy(); + return this; + } + } + } + protected class WidgetLabelHandler extends Handler { public Handler process() throws SAXException { switch (event) { @@ -522,14 +539,10 @@ } contextWidgets.addFirst(contextWidget); contextWidget = widget; - out.element(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS, "struct"); - out.attributes(); - out.startElement(); return this; case EVENT_ELEMENT: return nestedTemplate(); case EVENT_END_ELEMENT: - out.copy(); contextWidget = (Widget)contextWidgets.removeFirst(); return this; default: @@ -553,8 +566,6 @@ // Choose does not change the context widget like Union does: // contextWidget = widget; chooseWidgets.addFirst(widget); - out.element(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS, "choose"); - out.startElement(); return this; case EVENT_ELEMENT: if (Constants.TEMPLATE_NS.equals(input.uri)) { @@ -563,7 +574,7 @@ if (testValue == null) throwSAXException("Element \"when\" missing required \"value\" attribute."); String value = (String)((Widget)chooseWidgets.get(0)).getValue(); if (testValue.equals(value)) { - return nestedHandler; + return skipHandler; } else { return nullHandler; } @@ -576,7 +587,6 @@ return choosePassThruHandler; } case EVENT_END_ELEMENT: - out.endElement(); chooseWidgets.removeFirst(); contextWidget = (Widget)contextWidgets.removeFirst(); return this; @@ -597,7 +607,7 @@ if (testValue == null) throwSAXException("Element \"when\" missing required \"value\" attribute."); String value = (String)((Widget)chooseWidgets.get(0)).getValue(); if (testValue.equals(value)) { - return nestedHandler; + return skipHandler; } else { return nullHandler; } @@ -627,8 +637,6 @@ } contextWidgets.addFirst(contextWidget); contextWidget = widget; - out.element(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS, "union"); - out.startElement(); return this; case EVENT_ELEMENT: if (Constants.TEMPLATE_NS.equals(input.uri)) { @@ -637,7 +645,7 @@ if (id == null) throwSAXException("Element \"case\" missing required \"id\" attribute."); String value = (String)contextWidget.getValue(); if (id.equals(value != null ? value : "")) { - return nestedHandler; + return skipHandler; } else { return nullHandler; } @@ -650,7 +658,6 @@ return unionPassThruHandler; } case EVENT_END_ELEMENT: - out.endElement(); contextWidget = (Widget)contextWidgets.removeFirst(); return this; default: @@ -667,7 +674,7 @@ if (Constants.TEMPLATE_NS.equals(input.uri)) { if ("case".equals(input.loc)) { if (contextWidget.getValue().equals(input.attrs.getValue("id"))) { - return nestedHandler; + return skipHandler; } else { return nullHandler; }