Certainly namespaces do complicate things a little. to get a handle on XPath you could try following some of the useful links on this page
http://dom4j.org/index.html If you wanted to find the ImageResolution of the 'Device' in MyDeviceProfile using XPath then you could do this SAXReader reader = new SAXReader(); Document document = SAXReader.read( "myrdf.xml" ); String imageRes = document.valueOf( "/rdf:RDF/rdf:Description[@rdf:ID='MyDeviceProfile#]/rdf:component/rdf:Descr iption[@rdf:ID='Device']/prf:ImageResolution" ); Though its a fairly big XPath expression in RDF when using XPath and namespaces. By default dom4j will use the prefixes used in your document. Though strictly speacking you should specify the prefixes you wish to use in XPath yourself so that any prefix can be used in the source documents - prefixes are just syntax sugar - its the URIs that are the really important stuff. So in the current daily build you can do things like... // build a Map of namespace prefixes and URIs Map uris = new HashMap(); uris.put( "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/" ); uris.put( "m", "urn:xmethodsBabelFish" ); XPath xpath = document.createXPath( "/SOAP-ENV:Envelope/SOAP-ENV:Body/m:BabelFish" ); xpath.setNamespaceURIs( uris ); Node element = xpath.selectSingleNode( document ); James ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 12, 2001 4:04 PM Subject: [dom4j-dev] Newbie-question Hi there! I'm a newbie in using dom4j and I'm even not sure if do4j is the best solution for my purposes: I want to work with some XML-Docs like: --- <?xml version="1.0"?> <rdf:RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:prf="http://www.w3.org/ccppschema-20010430#"> <rdf:Description rdf:ID="MyDeviceProfile"> <prf:component> <rdf:Description rdf:ID="Device"> <rdf:type rdf:resource="http://www.host.org#ccppschema"/> <prf:ImageResolution>800x600</prf:ImageResolution> <prf:Accept> <rdf:Bag> <rdf:li>image/jpeg</rdf:li> <rdf:li>audio/wav</rdf:li> <rdf:li>audio/mp3</rdf:li> </rdf:Bag> </prf:Accept> </rdf:Description> </prf:component> </rdf:Description> </rdf:RDF> ----------- And I have some of these kind of documents. After loading I'd like to query for some Attributes (maybe xpath?) and get the attribute for further processing. My first attempts stucked after getting only ONE Element, Attribute and Value. I think, it's because of Namespace-problems. Somebody has ideas? Maybe works on similiar issues? Any help is really appreciated, best regards, Marc ____________________________________________________ Berufsunfähigskeitversicherung von Mamax bei WEB.DE. Jetzt informieren! http://bu.web.de _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev