Hi Stefan ----- Original Message ----- From: <[EMAIL PROTECTED]> > Hi, > > I have got some problems concerning namespaces. I have been using the > DOM implementation and tried to evaluate XPath expressions. As long as > my document does not contain any namespace declarations everything works > fine. However, if it does (with or without prefixes) I get an empty > result list. I am currently working on a Navigator implementation for my > "DOM" and I would like to make sure that the results for DOM and my > implementation are actually identical, so I have to understand that > namespace problem. Sorry, couldn't find anything in the archives.
You need to create a NamespaceContext instance and define the prefixes you want to use in your XPath expressions and the namespace URIs that they match to. e.g. here's an example which would navigate a SOAP document. SimpleNamespaceContext nsContext = new SimpleNamespaceContext(); nsContext.addNamespace( "env", "http://www.w3.org/2001/12/soap-envelope" ); ... XPath xpath = new XPath( "/env:Envelope/env:Body" ); > In the next step I would actually like to implement a Navigator that > supports an object model which is not implementing the Node etc. > interfaces of the W3C. The way Jaxen is abstracting the evaluation of > XPath expressions from the actual object model, seems to suggest that > this should be a "pretty straightforward" task along the lines of other > Navigator implementations I have looked at. Any thoughts on that ? Or is > my understanding of Jaxen wrong ? You're understanding is totally correct. Looking at the existing implementations of the Navigators should help you figure out how to build new ones. Hopefully most of the common code is in the DefaultNavigator base class so you should only need to implement a few things, particularly the axes. James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest