[gxml: 1/3] Fixed Node.attrs.get()



commit 9f68fd75bf8e9bb517ce60c6f15d14feea80e7d6
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Apr 15 21:23:43 2015 -0500

    Fixed Node.attrs.get()
    
    * SerializableArrayList tests ported to GXml.Element API, missed
      port Serializable to GXml.Node

 gxml/libxml-Element.vala               |    5 +----
 gxml/libxml-Node.vala                  |    2 +-
 test/SerializableGeeArrayListTest.vala |    7 +++----
 3 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index 7e47362..2ca6a4c 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -79,9 +79,6 @@ namespace GXml {
                        }
                }
 
-               // Note that NamedNodeMap is 'live' so changes to the Node should be seen in an already 
obtained NamedNodeMap
-               private new NamedAttrMap _attributes = null;
-
                /**
                 * Contains a { link GXml.NamedAttrMap} of
                 * { link GXml.Attr} attributes associated with this
@@ -101,7 +98,7 @@ namespace GXml {
                                if (this._attributes == null) {
                                        this._attributes = new NamedAttrMap (this);
                                }
-                               return this._attributes;
+                               return (NamedAttrMap) this._attributes;
                        }
                        internal set {
                        }
diff --git a/gxml/libxml-Node.vala b/gxml/libxml-Node.vala
index 026179d..0093084 100644
--- a/gxml/libxml-Node.vala
+++ b/gxml/libxml-Node.vala
@@ -39,7 +39,7 @@ namespace GXml {
         */
        public abstract class xNode : GLib.Object, GXml.Node {
                protected NodeList _child_nodes;
-               protected Gee.Map<string,xNode> _attributes = new Gee.HashMap<string,xNode> ();
+               protected NamedAttrMap _attributes = null;
                internal NamespaceAttrNodeList _namespace_definitions = null;
                /* Constructors */
                internal xNode (NodeType type, xDocument owner) {
diff --git a/test/SerializableGeeArrayListTest.vala b/test/SerializableGeeArrayListTest.vala
index 41d3062..6210c8f 100644
--- a/test/SerializableGeeArrayListTest.vala
+++ b/test/SerializableGeeArrayListTest.vala
@@ -80,9 +80,8 @@ class SerializableGeeArrayListTest : GXmlTest
         bool found1 = false;
         bool found2 = false;
         foreach (GXml.Node n in root.childs) {
-          GLib.message ("Node name ="+n.name);
           if (n is Element && n.name == "aelement") {
-            var name = ((xElement) n).get_attribute_node ("name");
+            var name = n.attrs.get ("name");
             if (name != null) {
               if (name.value == "Big") found1 = true;
               if (name.value == "Small") found2 = true;
@@ -90,11 +89,11 @@ class SerializableGeeArrayListTest : GXmlTest
           }
         }
         if (!found1) {
-          stdout.printf (@"ERROR: Big space node is not found\n");
+          stdout.printf (@"ERROR: Big space node was not found\n");
           assert_not_reached ();
         }
         if (!found2) {
-          stdout.printf (@"ERROR: Small space node is not found\n");
+          stdout.printf (@"ERROR: Small space node was not found\n");
           assert_not_reached ();
         }
       }


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