Re: [Vala] The name `type' does not exist in the context of `Xml.XPath.Object*'



في ج، 19-08-2011 عند 22:39 -0700 ، كتب Joseph Montanez:
I was able to resolve it I had a complete brain fart on the fact
libxml is not gobject. So I switched the "var" to "unowned" and the
datatype.

              // Search for Posts
              Xml.XPath.order_doc_elements (doc);
              var xpath = new Xml.XPath.Context(doc);
              unowned Xml.XPath.Object results = xpath.eval("//content");

This has nothing to do with the fact that it isn't a gobject. The
returned object is a pointer so you need to make sure whether it needs
to be freed or not. And for accessing a field from a pointer you use ->
instead of . so your code would use results->type etc.

Of course, if you are sure it doesn't need to be freed then it's better
to assign it to an unowned reference. (and if it should, then assign it
to an owned reference).

HTH,
Abderrahim




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