Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 25480 invoked from network); 27 Oct 2003 17:39:12 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 27 Oct 2003 17:39:12 -0000 Received: (qmail 9727 invoked by uid 500); 27 Oct 2003 17:39:04 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 9666 invoked by uid 500); 27 Oct 2003 17:39:04 -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 9654 invoked by uid 500); 27 Oct 2003 17:39:03 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 9651 invoked from network); 27 Oct 2003 17:39:03 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 27 Oct 2003 17:39:03 -0000 Received: (qmail 25445 invoked by uid 1758); 27 Oct 2003 17:39:10 -0000 Date: 27 Oct 2003 17:39:10 -0000 Message-ID: <20031027173910.25444.qmail@minotaur.apache.org> From: unico@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/transformation SourcePropsWritingTransformer.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N unico 2003/10/27 09:39:10 Modified: src/blocks/repository/java/org/apache/cocoon/transformation SourcePropsWritingTransformer.java Log: change props element to set, add remove functionality Revision Changes Path 1.2 +70 -24 cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java Index: SourcePropsWritingTransformer.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SourcePropsWritingTransformer.java 24 Oct 2003 19:33:46 -0000 1.1 +++ SourcePropsWritingTransformer.java 27 Oct 2003 17:39:10 -0000 1.2 @@ -95,13 +95,15 @@ /** incoming elements */ public static final String PATCH_ELEMENT = "patch"; public static final String SOURCE_ELEMENT = "source"; - public static final String PROPS_ELEMENT = "props"; + public static final String SET_ELEMENT = "set"; + public static final String REMOVE_ELEMENT = "remove"; /** The current state */ private static final int STATE_OUTSIDE = 0; private static final int STATE_PATCH = 1; private static final int STATE_SOURCE = 2; - private static final int STATE_PROPS = 3; + private static final int STATE_SET = 3; + private static final int STATE_REMOVE = 4; private int state; @@ -148,7 +150,7 @@ */ public void startTransformingElement(String uri, String name, String raw, Attributes attr) throws SAXException, IOException, ProcessingException { - if (this.getLogger().isDebugEnabled() == true) { + if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("BEGIN startTransformingElement uri=" + uri + ", name=" + name + ", raw=" + raw + ", attr=" + attr); } @@ -163,10 +165,12 @@ this.startTextRecording(); // Element: props - } else if (this.state == STATE_PATCH && name.equals(PROPS_ELEMENT)) { - this.state = STATE_PROPS; + } else if (this.state == STATE_PATCH && name.equals(SET_ELEMENT)) { + this.state = STATE_SET; + this.startRecording(); + } else if (this.state == STATE_PATCH && name.equals(REMOVE_ELEMENT)) { + this.state = STATE_REMOVE; this.startRecording(); - } else { super.startTransformingElement(uri, name, raw, attr); } @@ -197,41 +201,62 @@ } // Element: patch - if ((name.equals(PATCH_ELEMENT) && this.state == STATE_PATCH)) { + if ((this.state == STATE_PATCH && name.equals(PATCH_ELEMENT))) { this.state = STATE_OUTSIDE; String sourceName = null; String tag = null; - DocumentFragment frag = null; + DocumentFragment setfrag = null; + DocumentFragment removefrag = null; do { tag = (String)this.stack.pop(); if (tag.equals(SOURCE_ELEMENT)) { sourceName = (String)this.stack.pop(); - } else if (tag.equals(PROPS_ELEMENT)) { - frag = (DocumentFragment)this.stack.pop(); + } else if (tag.equals(SET_ELEMENT)) { + setfrag = (DocumentFragment)this.stack.pop(); + } else if (tag.equals(REMOVE_ELEMENT)) { + removefrag = (DocumentFragment)this.stack.pop(); } } while ( !tag.equals("END") ); - NodeList list = frag.getChildNodes(); - Node node = null; - for (int i=0; i