Hi jidanni,
as Lukas already mentioned, the best (cleanest) way to get rid of namespaces is to use a recursive function. The following query should work out of the box. You can save in a file and pass it on as command-line argument to basex: ______________________
declare function local:strip-namespace($e) { element { QName((), local-name($e)) } { for $child in $e/(@*,*) return if ($child instance of element()) then local:strip-namespace($child) else $child } };
let $doc := doc('http://gdata.youtube.com/feeds/api/playlists/1ADE82BB5C96D594?prettyprint=tr...') return local:strip-namespace($doc/*)
Fyi, Alex has added some more issues you encountered to the GitHub list:
https://github.com/BaseXdb/basex/issues/
Best, Christian ___________________________
On Sat, Nov 26, 2011 at 11:26 AM, Alexander Holupirek alexander.holupirek@uni-konstanz.de wrote:
Hi Jidanni,
if you're only interested in the thumbnails plus some dedicated attributes:
<thumbnail url="http://i.ytimg.com/vi/_eXJ2JEPKuc/0.jpg" height="360" width="480" time="00:01:48"/> <thumbnail url="http://i.ytimg.com/vi/_eXJ2JEPKuc/1.jpg" height="90" width="120" time="00:00:54"/> <thumbnail url="http://i.ytimg.com/vi/_eXJ2JEPKuc/2.jpg" height="90" width="120" time="00:01:48"/>
Then this might help:
declare namespace ...
for $e in doc('input')/atom:feed/atom:entry for $t in $e/media:group/media:thumbnail return element { $t/local-name() } { $t/(@url, @height, @width, @time) }
Kind regards, Alex
On 26.11.2011, at 10:59, jidanni@jidanni.org wrote:
OK, thanks. It turns out I forgot to escape the # at app# in my makefile. So I am back in business. Now I am curious how to get rid of the namespaces in output. declare copy-namespaces no-preserve, inherit doesn't work.
$ basex -Vc "OPEN input; XQUERY declare copy-namespaces no-preserve, inherit; declare namespace atom='http://www.w3.org/2005/Atom'; declare namespace app='http://purl.org/atom/app#'; declare namespace media='http://search.yahoo.com/mrss/'; declare namespace openSearch='http://a9.com/-/spec/opensearchrss/1.0/'; declare namespace gd='http://schemas.google.com/g/2005'; declare namespace gml='http://www.opengis.net/gml'; declare namespace yt='http://gdata.youtube.com/schemas/2007'; declare namespace georss='http://www.georss.org/georss'; for $e in /atom:feed/atom:entry for $t in $e/media:group/media:thumbnail return $t" Database 'input' opened in 65.84 ms. <media:thumbnail xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://purl.org/atom/app#" xmlns:media="http://search.yahoo.com/mrss/" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:gml="http://www.opengis.net/gml" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:georss="http://www.georss.org/georss" url="http://i.ytimg.com/vi/_eXJ2JEPKuc/0.jpg" height="360" width="480" time="00:01:48"/> ... How can I just get <media:thumbnail url="http://i.ytimg.com/vi/_eXJ2JEPKuc/0.jpg" height="360" width="480" time="00:01:48"/> Thanks. _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk