qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] namespaces in xquery


From: Per Bothner
Subject: Re: [Qexo-general] namespaces in xquery
Date: Fri, 21 Nov 2003 09:15:25 -0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030827

Víctor Torres Padrosa wrote:

I would be grateful if anyone could help me.
I'm using kawa-1.7.jar and it seems that it does not understand the namespace's declarations.

It does.  They are used to properly parse and match QNames.
However, Kawa 1.7 doesn't print out namespace declarations properly.
CVS Kawa does print out namespace nodes properly, at least those
that arise from input .xml documents.  (It doesn't handle
namespace declarations from constructed nodes yet.)

1- Given the following xml file (did.xml):

<?xml version="1.0" encoding="UTF-8"?>

<didl:DIDL>

<r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:sx="urn:mpeg:mpeg21:2003:01-REL-SX-NS" xmlns:mx="urn:mpeg:mpeg21:2003:01-REL-MX-NS" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#";>......</r:license>

.....

</didl:DIDL>

This is not a namespace-correct XML file - there is no
namespace declaration for didl.

This result does not have the namespaces! Does anyone know how to keep them?

Try the CVS version of Kawa.

(I may try to do a quick 1.7.90 snapshot/beta this weekend.)

I would be also interested in extracting the namespace´s prefixes (r, sx, and mx) given their urn expression (urn:mpeg:mpeg21:2003:01-REL-R-NS, urn:mpeg:mpeg21:2003:01-REL-SX-NS and urn:mpeg:mpeg21:2003:01-REL-MX-NS).

You could do that with the standard fn:get-in-scope-prefixes.
Unfortinately, I haven't implemented it yet.  However, it should
be easy to implement it, and I plan to do so for Kawa 1.8.

The function I'm using to evaluate the query is the following:
result=xq.eval(squery);
            XMLPrinter xp = new XMLPrinter(out);
            xp.writeObject(result);

This would be more efficient:

XMLPrinter xp = new XMLPrinter(out);
xq.eval(squery, out);
--
        --Per Bothner
address@hidden   http://per.bothner.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]