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="";>

has been changed to

<giml xmlns="";>

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

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

and I constructed a similiar example :
<?xml version="1.0" encoding="UTF-8" ?>
  <context type="dialog">
      <control id="UserName" type="characterinput_alphabetic"/>
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 type

am I totaly lost ?

Finaly about "xmlXPathNewContext()", when I had been using a namespace with a prefix I was using
before using the context. Now that namespace has a "ns->prefix==NULL", should I still attach it or better use
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
===-=-=--=---=---------------------------------- - - -  -    -

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