If I understand you correctly, the following will return <Patient> element:
SAXReader reader = new SAXReader(); Document document = reader.read( new File( "patient_records.xml" ) ); Element contactInfo = document.selectSingleNode( "//ContactInfo", "." ); Element patient = contactInfor.getParent(); Then you can use the Node API to traverse the <Patient> element returned. Also, if <Patient> is the root element, then you can do the following: SAXReader reader = new SAXReader(); Document document = reader.read( new File( "patient_records.xml" ) ); Element patient = document.getRootElement(); Best regards Ben On Sat, 2002-11-16 at 23:52, Pae Choi wrote: Say we have an XML document as follows:
|
- [dom4j-user] XPath result from a DOM and the Rest of DOM Pae Choi
- [dom4j-user] DOM4J User Archives Pae Choi
- Re: [dom4j-user] XPath result from a DOM and the Rest ... Benjamin Kopic
- Re: [dom4j-user] XPath result from a DOM and the R... Pae Choi
- Re: [dom4j-user] XPath result from a DOM and t... Pae Choi
- Re: [dom4j-user] XPath result from a DOM and t... David D. Lucas
- Re: [dom4j-user] XPath result from a DOM a... Pae Choi
- Re: [dom4j-user] XPath result from a ... David D. Lucas
- Re: [dom4j-user] XPath result fro... Pae Choi
- Re: [dom4j-user] XPath result... David D. Lucas
- [dom4j-user] Validation Igor Akkerman
- Re: [dom4j-user] XPath result... Pae Choi
- Re: [dom4j-user] XPath result from a DOM and t... James Strachan