Re: [xml] xmllint --shell + incorrect behavior



On Tue, Sep 17, 2002 at 03:34:42PM -0700, OrangeCrush wrote:

Hi,

I use the xmllint --shell print.xml (attached file) and the following
is the result.  The incorrect behavior happens after I do a cd .. to
go back to the root directory and try to cd into ADDRESSBOOK[2] which
was the result I got by doing pwd.  As you can see below that it tells
me that the node does not exist but according to pwd it does exist. Is
this the correct behavior? I traced it to function xmlGetNodePath which
is used by the pwd command.  Is it possible that this function might be
producing wrong results?

  Yes it's a bug, xmlGetNodePath() when computing the index forget to check
that a node is an element before checking for the name, and in this case
there is a preceeding sibling PI with the same name, hence the error. I knew
about it but never went to fix it, thanks for raising it again :-)

paphio:~/XML -> xmllint --shell print.xml 
/ > ls
?an        1 ADDRESSBOOK
---       17 ADDRESSBOOK
/ > 
/ > / > pwd
Unknown command /
/ > cd /
/ > cd /ADDRESSBOOK
ADDRESSBOOK >  exit
paphio:~/XML -> 

  patch enclosed,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Attachment: path.patch
Description: Text document



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