db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Russell <douglas.russ...@comlab.ox.ac.uk>
Subject Re: Derby XMLQUERY XPATH
Date Thu, 21 Jun 2007 15:45:59 GMT
Yeah, thanks, this is basically what I'd come up with as well, I was hoping 
there was a more elegant way though. In DB2 it looks like there is a way of 
setting the dictionary of namespaces to resolve in the database query which 
then gets passed though to the backend to use when resolving in Xalan. 
Presumably that's a feature that Derby will get in the future, allowing the 
myns:Name syntax to be used.

For reference, what I ended up with was (To get the text content of the Name 
field):

statement.execute(
		"SELECT ID, " +
			"XMLSERIALIZE( " +
				"XMLQUERY('//*[local-name()=\"Name\" and 
namespace-uri()=\"http://www.myproject.ox.ac.uk/MyProject\"]/text()' PASSING 
BY REF Definition EMPTY ON EMPTY) " +
			"AS VARCHAR(10000)) " +
			"FROM My_Schema.My_Table");

Thanks very much for your suggestions.

Douglas

-- 
Douglas PW Russell
Research Officer - GIMI/NeuroGrid
Oxford University Computing Laboratory
Tel:	+44 (0)1865 283519
email:	douglas.russell@comlab.ox.ac.uk

Mime
View raw message