> Thanks James. Is this something in TODO for dom4j (i.e. is there a need for XPath support in ElementHandlers)?
Yes. I think it'd be a cool addition yes. There's already the XSLT-pattern matching code in the org.dom4j.rule package which is capable of performing XSLT style template pattern matching. We just need to hook that up as an ElementHandler. Shouldn't be too hard if anyone fancies taking a stab at it. James ------- http://radio.weblogs.com/0112098/ ----- Original Message ----- From: Benjamin Kopic To: [EMAIL PROTECTED] Sent: Friday, November 15, 2002 10:12 AM Subject: Re: [dom4j-user] ElementPath to use XPath expression Thanks James. Is this something in TODO for dom4j (i.e. is there a need for XPath support in ElementHandlers)? Best regards Ben On Fri, 2002-11-15 at 07:27, James Strachan wrote: Unfortunately true XPath (or XSLT-patterns) style matching hasn't been added yet to the ElementHandlers. Though you could always split your XPath into 2 and register the ElementHandler for ("/table/metaData/record") then when you get each Element evaluate the XPath expression "field[@fID=':1']" Another approach, if you don't want to splitup your XPaths, is to just register an ElementHandler and on each Element perform an XPath test. Though the previous suggestion will be a bit more efficient, since most of the XPath has already been evaluated for you. James ------- http://radio.weblogs.com/0112098/ ----- Original Message ----- From: Benjamin Kopic To: [EMAIL PROTECTED] Sent: Thursday, November 14, 2002 1:15 PM Subject: [dom4j-user] ElementPath to use XPath expression Hi I am trying to use XPath expression as the path value when registering ElementHandler, and it seems that ElementPath is not an equivalent to XPath (which makes sense). However, I need to get the below test to work: public void testXPath() { SAXReader saxReader = new SAXReader(); FieldMetaDataHandler fmdh0 = new FieldMetaDataHandler(); saxReader.addHandler("/table/metaData/record/field[@fID=':1']", fmdh); try { saxReader.read(TEST_DOC_URL); } catch(DocumentException de) { System.out.println("Problem reading: " + TEST_DOC_URL); throw de; } assertTrue("ID read ("+fmdh.getFId()+") does not match expected (:1)", ":1".equals(fmdh.getFId())); } Unfortunately, the files manipulated are huge and hence we need to process them only when a particular element is reached. Has anyone done anything similar? (BTW: This is along the lines to James Strachan's message @: http://www.mail-archive.com/jaxen-interest@;lists.sourceforge.net/msg00793.ht ml) Best regards -- benjamin kopic m: +44 (0)780 154 7643 t: +44 (0)20 7794 3090 e: [EMAIL PROTECTED] w: http://www.panContext.com/ -- benjamin kopic m: +44 (0)780 154 7643 t: +44 (0)20 7794 3090 e: [EMAIL PROTECTED] w: http://www.panContext.com/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user