Re: [Vala] The name `type' does not exist in the context of `Xml.XPath.Object*'
- From: Joseph Montanez <jmontanez gorilla3d com>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] The name `type' does not exist in the context of `Xml.XPath.Object*'
- Date: Fri, 19 Aug 2011 22:39:37 -0700
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");
// Go through results
if (results != null && results.type == Xml.XPath.ObjectType.NODESET) {
unowned Xml.XPath.NodeSet nodes = result.nodesetval;
printerr ("got %d nodes\n", nodes.length());
for (int i = 0; i < nodes.length(); i++) {
unowned Xml.Node node = nodes.item(i);
printerr (" -> %s\n", node.get_path());
}
}
On Fri, Aug 19, 2011 at 8:17 PM, Joseph Montanez
<jmontanez gorilla3d com> wrote:
Is this a problem with the vapi? I tried removing the failing lines
and use the debugger with break points added to the c code. However
the xpath eval returns a variable that does have "type" and "nodeset".
https://gist.github.com/1158594
valac --version
Vala 0.13.2
valac --vapidir=vapi --pkg libsoup-2.4 --pkg libxml-2.0 --thread -g
--save-temps main.vala
main.vala:24.24-24.33: error: The name `type' does not exist in the
context of `Xml.XPath.Object*'
if (nodes != null && nodes.type == Xml.XPath.ObjectType.NODESET)
^^^^^^^^^^
main.vala:27.44-27.56: error: The name `nodeset' does not exist in the
context of `Xml.XPath.Object*'
nodes.nodeset.length());
^^^^^^^^^^^^^
Compilation failed: 4 error(s), 0 warning(s)
main.vala:28.24-28.36: error: The name `nodeset' does not exist in the
context of `Xml.XPath.Object*'
for (int i = 0; i < nodes.nodeset.length(); i++) {
^^^^^^^^^^^^^
main.vala:30.35-30.47: error: The name `nodeset' does not exist in the
context of `Xml.XPath.Object*'
nodes.nodeset.item(i).get_path());
I tried looking at the vapi and I can't see whats wrong with it.
[Compact]
[CCode (cname = "xmlXPathObject",
free_function="xmlXPathFreeObject", cheader_filename =
"libxml/xpath.h")]
public class Object {
public ObjectType type;
public NodeSet* nodesetval;
public int boolval;
public double floatval;
public string stringval;
public void* user;
public int index;
public void* user2;
public int index2;
}
--
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy
--
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]