Hi Philippe,
you still have to declare a default element namespace for XQuery (or XPath for that matter) to recognize the element you want to return:
declare default element namespace "http://example.org";
<feed xmlns="http://example.org" xmlns:abc="http://abc.example.org"> <title>Projects</title> </feed>/title
will work as expected.
I see that the solution is not obvious, but from the processors point of view: * the XML fragment has the http://example.org namespace * your path expressions don't.
I modified your example slightly to show an alternative way of doing this:
declare namespace a = "http://example.org"; declare namespace b = "http://abc.example.org";
<feed xmlns="http://example.org" xmlns:abc="http://abc.example.org"> <title abc:test="foo">Projects</title> </feed>/a:title[@b:test = "foo"]
Feel free to ask for more help when needed,
Michael
Am 24.05.2012 um 04:20 schrieb Philippe Rathé:
Hello there,
I just want to do a simple xpath expression but I can't get it works when I use this XML document
<?xml version="1.0" encoding='utf-8'?>
<feed xmlns="http://example.org" xmlns:abc="http://abc.example.org"> <title>Projects</title> </feed>
The expression "exquery //title" does not return anything from the CLI once I open the database containing only that file.
But it works with this file
<?xml version="1.0" encoding='utf-8'?>
<feed xmlns="http://example.org"> <title>Projects</title> </feed>
It looks like having both xmlns and xmlns:abc namespace attribute creates a problem. My real use case is atompub feed document which the 2 first lines looks like this:
<?xml version="1.0" encoding='utf-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app">
Any idea? I'm using a 7.2.2 snapshot, thanks. _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk