Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)


can anyone confirm and/or explain that?

xmllint --shell giml/gitkTemplate_message.xml
/ > cat
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE giml SYSTEM "";>
<giml xmlns="";

Here you define the default namespace as "";

  <dialog focus="ctrl">
     <dialogwidget id="Okay"/>
      <widget id="Message" type="label"/>

Therefore, element "widget" belong to namespace "";

/ > xpath //widget

And here you are asking for elements with localname "widget" and WITHOUT namespace (I think that XPath 
doesn't have the concept of default namespace, you always need to specify a prefix like "mynsprefix:widget")

Object is a Node Set :
Set contains 0 nodes:

And xmllint gives you the right answer.

I don't know how to use the shell xpath command in documents with declared default namespaces, since the 
shell utility doesn't have a command to register namespaces and prefixes (something like xmlXPathRegisterNs).


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