[gxml] Fixes on make check



commit ca2df40243efbc0f3ab1aaf100cf575e82c91f82
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Feb 11 22:56:53 2016 -0600

    Fixes on make check

 gxml/TwAttribute.vala |   10 ++++++++++
 gxml/TwDocument.vala  |   12 ++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gxml/TwAttribute.vala b/gxml/TwAttribute.vala
index c00e062..d6131a9 100644
--- a/gxml/TwAttribute.vala
+++ b/gxml/TwAttribute.vala
@@ -26,6 +26,7 @@ using Gee;
  */
 public class GXml.TwAttribute : GXml.TwNode, GXml.Attribute
 {
+  protected Gee.ArrayList<GXml.Node> _namespaces;
   public TwAttribute (GXml.Document d, string name, string value)
     requires (d is TwDocument)
   {
@@ -33,8 +34,17 @@ public class GXml.TwAttribute : GXml.TwNode, GXml.Attribute
     _name = name;
     _value = value;
   }
+  // Node
+  public override Gee.List<GXml.Namespace> namespaces {
+    owned get {
+      if (_namespaces == null) _namespaces = new Gee.ArrayList<GXml.Node> ();
+      return _namespaces.ref () as Gee.List<GXml.Namespace>;
+    }
+  }
+  // Attribute
   public Namespace @namespace {
     owned get {
+      if (_namespaces == null) _namespaces = new Gee.ArrayList<GXml.Node> ();
       return (Namespace) namespaces.get (0).ref ();
     }
     set {
diff --git a/gxml/TwDocument.vala b/gxml/TwDocument.vala
index 353fbbe..6ab64bd 100644
--- a/gxml/TwDocument.vala
+++ b/gxml/TwDocument.vala
@@ -31,6 +31,7 @@ using Xml;
 public class GXml.TwDocument : GXml.TwNode, GXml.Document
 {
   protected Gee.ArrayList<GXml.Node> _namespaces;
+  protected Gee.ArrayList<GXml.Node> _children;
   GXml.Element _root = null;
   construct {
     _name = "#document";
@@ -48,6 +49,12 @@ public class GXml.TwDocument : GXml.TwNode, GXml.Document
       return _namespaces.ref () as Gee.List<GXml.Namespace>;
     }
   }
+  public override Gee.BidirList<GXml.Node> children {
+    owned get {
+      if (_children == null) _children  = new Gee.ArrayList<GXml.Node> ();
+      return _children.ref () as Gee.BidirList<GXml.Node>;
+    }
+  }
   /**
    * { inheritDoc}
    *
@@ -77,10 +84,11 @@ public class GXml.TwDocument : GXml.TwNode, GXml.Document
   public GLib.File file { get; set; }
   public GXml.Node root {
     owned get {
+      if (_children == null) _children  = new Gee.ArrayList<GXml.Node> ();
       if (_root == null) {
         int found = 0;
-        for (int i = 0; i < childs.size; i++) {
-          GXml.Node n = childs.get (i);
+        for (int i = 0; i < children.size; i++) {
+          GXml.Node n = children.get (i);
           if (n is GXml.Element) {
             found++;
             if (found == 1)


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