Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 38947 invoked from network); 20 Jan 2005 00:58:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Jan 2005 00:58:37 -0000 Received: (qmail 81299 invoked by uid 500); 20 Jan 2005 00:58:33 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 80989 invoked by uid 500); 20 Jan 2005 00:58:32 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 80971 invoked by uid 99); 20 Jan 2005 00:58:32 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from subdns1.tech.beacon-it.co.jp (HELO subdns1.tech.beacon-it.co.jp) (61.194.41.162) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 19 Jan 2005 16:58:31 -0800 Received: from tech.beacon-it.co.jp (tcint1 [172.22.160.204]) by subdns1.tech.beacon-it.co.jp (Postfix) with ESMTP id A7A11F26FA for ; Thu, 20 Jan 2005 09:58:27 +0900 (JST) Received: from [172.22.160.88] (utvsrv.tech.beacon-it.co.jp [172.22.160.202]) by tech.beacon-it.co.jp (8.9.3 (PHNE_22672)/3.7Wpl2.01030916) with ESMTP id JAA18791 for ; Thu, 20 Jan 2005 09:55:45 +0900 (JST) Message-ID: <41EF0236.3000802@tech.beacon-it.co.jp> Date: Thu, 20 Jan 2005 09:58:30 +0900 From: Bill Keese User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [digester] Can rules be re-used? References: <1106049822.21303.62.camel@blackbox> <41EDAFE0.4000604@tech.beacon-it.co.jp> <1106098791.10423.36.camel@blackbox> <41EDBD4A.30106@tech.beacon-it.co.jp> <1106113685.10423.47.camel@blackbox> In-Reply-To: <1106113685.10423.47.camel@blackbox> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I see. Although an XML file containing rules is clearly read-only (thus corresponding to the traditional english-language meaning of "rule"), I guess the "Rule" class is more like a "tag processor", or something like that. Well, it would be easy to write Rule classes if Digester instantiated a new Rule object for each element it processed. But since the Rule objects are reused, it gets tricky. Simon Kitching wrote: >>If there is only one Rule to process elements (matching pattern >>*/foo), won't bodyText get mangled? >> >> > >For those which have a Stack member: no. This will work fine >"recursively", but will fail in multi-threaded environments. > > Hmm, if you go so far as to use a stack, you might as well store the stack in the calling Digester object rather than in the Rule object. That would make the Rule object stateless and thus thread safe. Of course, you would also need to get rid of the Digester back-reference. Bill --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org