Re: [xml] Namespace Handling



Dear Daniel, Tobias,
        I think I understand now. While in the document we
have one prefix, the query can have a completely different one,
as long as they both map to the same target namespace. The document
namespace declarations map tags to one namespace. They are not
instructions for the XPath processor to be registered. I as a
querier, if I want to make a namespace prefixed query, have
to define their namespaces and my own prefix (which may or may not be
the same as the original ones). Then I query  with my prefix.

so for my last example (sent offlist)

<foo>
        <bar stool="barstool">
                <stool:interesting/>
        </bar>
</foo>

I myself as the querier have to  reqister namespace prefix "q" with namespace
target "barstool" and then perform XPath queries a la:

//q:interesting

I would like to thank both of you for your kind and very patient help.

        With best wishes,
                Balint


Daniel Veillard wrote:
On Wed, Sep 10, 2003 at 11:11:07AM +0100, Balint Joo wrote:

How do I select <stool:interesting> with an XPath query?
I haven't trawled my document so the namespace "barstool"
is not in my context. However I haven't yet done any queries


  Ho can you query for something you don't know ? If you
don't know the namespace name you're looking for you can't
make a query. The prefix is not sufficient knowledge.

Daniel



--
-------------------------------------------------------------------
Dr Balint Joo                         Post Doctoral Research Fellow
School of Physics
University of Edinburgh
Mayfield Road, Edinburgh EH9 3JZ
Scotland UK
Tel: 0131 650 6469 (from UK) +44-131-650-6469 (from outwith UK)
Fax: 0131 650 5902 (from UK) +44-131-650-5902 (from outwith UK)
email: bj ph ed ac uk           bj phys columbia edu
WWW  : http://www.ph.ed.ac.uk/~bj
-------------------------------------------------------------------




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