Re: [xml] xmllint and namespaces



Hi Daniel,

Thanks for your help, but I am not over with the issue. I prefered not to pollute my files and so I got rid of the namespace prefix (as I will not mix my xml-data with other). So

<giml:giml xmlns:giml="http://gitk.sourceforge.net/";>
   <giml:context/>
</giml:giml>

has been changed to

<giml xmlns="http://gitk.sourceforge.net/";>
   <context/>
</giml>

I keep the default namespace. No all of my xpath queries are broken.


  Read the XPath spec. the "giml" XPath expression will only select
nodes of name "giml" but without namespace. You need to keep the namespace
in the XPath query to match those node.
  Sorry I can't debug the code. I assume the problem comes from what
I just said.

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.

I found the thread http://mail.gnome.org/archives/xml/2001-December/msg00072.html

which seems to reflect my problem, but I don't understand the problem behind. Unfortunately there is no reply of you in this thread.

Further I found the thread
http://mail.gnome.org/archives/xml/2002-January/msg00177.html

and I constructed a similiar example :
<?xml version="1.0" encoding="UTF-8" ?>
<giml>
  <context type="dialog">
    <controlgroup>
      <control id="UserName" type="characterinput_alphabetic"/>
    </controlgroup>
  </context>
</giml>
and invoked
# testXPath -i share/gitk/gitkHelloUser_main.xml "//control[ id="UserName"]"
Object is a Node Set :
Set contains 0 nodes:

on the other hand see this
# testXPath -i share/gitk/gitkHelloUser_main.xml "//control"
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT control
    ATTRIBUTE id
      TEXT
        content=UserName
    ATTRIBUTE type
      TEXT
        content=characterinput_alphabetic

am I totaly lost ?

Finaly about "xmlXPathNewContext()", when I had been using a namespace with a prefix I was using
        ctxt->namespaces=g_new(xmlNsPtr,1);
        ctxt->namespaces[0]=mynamespace;
        ctxt->nsNr=1;
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.

Stefan (currently doing 'make check' ...)
--
      \|/            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]