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/[email protected]/msg00793.html)
Best regards
-- benjamin kopic m: +44 (0)780 154 7643 t: +44 (0)20 7794 3090 e: [EMAIL PROTECTED] w: http://www.panContext.com/ |
