Re: [xml] XPath query failing on modified xmlDoc



Cory Virok wrote:

Ok, I'm new to libxml2 in general so there's probably a very simple solution to this problem, (haven't been able to find it in the archives though.)

I have an xml document that I load up and modify. In this particular instance, I load the document and then add in a new child element. I have verified that the child is in the doc by doing a quick xmlDocDump(). After I add children I want to be able to remove them. The problem I'm seeing is that when I do an XPath query for the children that existed prior to loading the document everything's fine, but when I query for the children that I just added I get back an empty node set.

I remake the XPath context using the same doc pointer each time I query so I know that the xpath context is using the right doc... It seems like the DOM tree hasn't been updated and thus the xpath query cannot find the child nodes, but I've verified that the tree is up-to-date...

The only thing I can think of is the format of my xpath expression, which does not use explicit '[1]' or 'descendant::' etc...

/config/user-list/user[ nickname="NICKNAME"]

Any help is appreciated.

- Cory Virok
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml

So either no one understands my question or it's just been ignored. Either way I'd like to try posting it again.
Anyone?

- Cory Virok



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