Search code examples
xpathlibxml2vala

how to use xpath in vala on a node object


How do I use XPath in Vala on a Xml.Node object?

The only examples I can find is were a Context is created from a Doc object, but I don't have a Xml.Doc object to begin with. Is there a way I can convert Xml.Node into Xml.Doc? Or is there some other way?

The example I'm looking at is : https://live.gnome.org/Vala/XmlSample

Thanks.


Solution

  • The Xml.Node class has a Xml.Doc doc member. You should be able to use that to get the relevant Xml.Doc for a node.