[gxml/gxml-0.16] Fix GDocument namespaces



commit d0976a8b596eb58dc334712d47db63b5b121a9ee
Author: Chris Lee <clee mg8 org>
Date:   Mon Feb 19 17:03:43 2018 -0700

    Fix GDocument namespaces
    
    Previously, it was impossible to add Namespace entries to a
    GListNamespaces returned by GDocument.namespaces; now, it
    works.
    
    ```vala
    
    var doc = new GDocument.from_string(xml);
    var ns = doc.namespaces;
    ns.add(new GNamespace(new Xml.Ns(null, "http://url";, "url")));
    var size = ns.size;
    GLib.debug(@"namespace size: $size");
    ```

 gxml/GXmlDocument.vala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gxml/GXmlDocument.vala b/gxml/GXmlDocument.vala
index 757af2e..7ebd3a9 100644
--- a/gxml/GXmlDocument.vala
+++ b/gxml/GXmlDocument.vala
@@ -95,7 +95,7 @@ public class GXml.GDocument : GXml.GNode,
   // GXml.Node
   public override Gee.Map<string,GXml.Node> attrs { owned get { return new GHashMapAttr (this, (Xml.Node*) 
doc) as Gee.Map<string,GXml.Node>; } }
   public override Gee.BidirList<GXml.Node> children_nodes { owned get { return new GListChildren (this, 
(Xml.Node*) doc) as Gee.BidirList<GXml.Node>; } }
-  public override Gee.List<GXml.Namespace> namespaces { owned get { return new GListNamespaces (this, 
(Xml.Node*) doc) as Gee.List<GXml.Namespace>; } }
+  public override Gee.List<GXml.Namespace> namespaces { owned get { return new GListNamespaces (this, 
doc->get_root_element()) as Gee.List<GXml.Namespace>; } }
   public override GXml.Document document { get { return this; } }
   // GXml.Document
   public bool indent { get; set; default = false; }


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