Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 71358 invoked from network); 20 Oct 2003 21:02:03 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 20 Oct 2003 21:02:03 -0000 Received: (qmail 33524 invoked by uid 500); 20 Oct 2003 21:01:46 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 33505 invoked by uid 500); 20 Oct 2003 21:01:46 -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 33492 invoked from network); 20 Oct 2003 21:01:45 -0000 Received: from unknown (HELO unxcoms01.ecnetwork.co.nz) (202.135.116.201) by daedalus.apache.org with SMTP; 20 Oct 2003 21:01:45 -0000 Received: from serpent.ecnetwork.co.nz (serpent [202.135.190.10]) by unxcoms01.ecnetwork.co.nz (8.12.8/8.12.8) with ESMTP id h9KL1plC032355 for ; Tue, 21 Oct 2003 10:01:51 +1300 Received: from [202.135.190.48] (unknown [202.135.190.48]) by serpent.ecnetwork.co.nz (Postfix) with ESMTP id 626331035 for ; Tue, 21 Oct 2003 09:04:26 +1200 (NZST) Subject: Re: [digester] how to make use of xml:lang? From: Simon Kitching To: Jakarta Commons Users List In-Reply-To: <20031020191436.45163.qmail@web13002.mail.yahoo.com> References: <20031020191436.45163.qmail@web13002.mail.yahoo.com> Content-Type: text/plain Message-Id: <1066683448.2540.1717.camel@PCSIMON.ecnnz.ecnetwork.co.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Tue, 21 Oct 2003 09:57:29 +1300 Content-Transfer-Encoding: 7bit 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 Hi Ricky, It looks to me like what you need is a Rules class which can match elements according to the value of specific attributes. None of the existing Rules classes do this, but it seems reasonable to me. The pattern syntax could include xpath-like conditions, eg obj/attr[xml:lang="en"] and only attr elements with an xml:lang attribute matching the specified value would be considered "matches" for the pattern. Implementing such a Rules class would be non-trivial, though. As a simpler solution along the same lines, how about writing a LangRules class which extends BaseRules (or whichever), and has a match method like: List matches = super.match(...) for each rule in matches { if xml:lang exists, and the attribute value is not the desired language { remove the element from the match list } } I'm not so keen on patching the Digester class itself to look explicitly for xml:lang attributes. It feels like a hack to me. Of course you can always modify Digester (or subclass it) for your own use. Of course if you feel up to implementing a generic Rules class as described above, then please do! Regards, Simon On Tue, 2003-10-21 at 08:14, Ricky Panaglucci wrote: > i want some properties set according to given locale. > if no lang:xml is specified in a given element, > its values are taken. if no maching lang:xml is found, > the element without lang:xml or with lang:xml="en" is > taken. > > there is a method setSchemaLanguage, but i do not use > schema. > > the best solution to me is indeed extending Digester, > hooking into startElement() ... > > locale: en > > <- take > this > > > > > > <- take this > > > > ricardo --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org