Re: [xml] xmllint and namespaces



Hi Daniel,

On Fri, Oct 25, 2002 at 10:45:24AM +0200, Stefan Kost wrote:

>I don't get it. I read the XPath spec over and over again, but there is nothing
>that convinces me that I am doing something wrong.


  you need to read more then,


>before using the context. Now that namespace has a "ns->prefix==NULL", should I
>still attach it or better use
>    ctxt->namespaces=NULL;
>    ctxt->nsNr=0;
>It seems to make no difference. I don't use "xmlXPathRegisterNs()" as there is
>no version of it accepting a xmlNsPtr.


Repeat after me
 "There is no notion of a default namespace in an XPath query"

Okay, but I have read (under http://www.w3.org/TR/xpath) :
"Thus, the name of a node is modeled as a pair consisting of a local part and a possibly null namespace URI; this is called an expanded-name."

and things like that, but can't find your quotation.


As a result libml2 does NOT allot to define a default namespace for
an XPath context.



cannot be seclected with
"//bar"

it can be selected with
"//foo:bar" when the XPath context contains a namespace binding
for the foo prefix mapping to the namespace name "http://example.com/foo";.
Just do it ! There is NO other way.

Daniel

I've done it, it does work now and I appreciate any help that I've got from the list, but even though I have read the specs again, I honestly didn't got it from the xpath specs that it has to be like this.

Stefan
--
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 300066
|      ///           04277 Leipzig      04277 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost gmx net    kost imn htwk-leipzig de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -




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