[gxml] Implemented GXml.Text
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Implemented GXml.Text
- Date: Wed, 29 Apr 2015 18:21:56 +0000 (UTC)
commit bd8256514d9f22c2f3acf5dbe02b5675300f7cf1
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Apr 29 12:26:47 2015 -0500
Implemented GXml.Text
* Added Document.create_text() and its implementation
* Replaced xDocument.create_text_node() with Document.create_text()
gxml/Document.vala | 1 +
gxml/SerializableObjectModel.vala | 8 ++++----
gxml/libxml-Document.vala | 3 +--
gxml/libxml-Text.vala | 4 +++-
4 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gxml/Document.vala b/gxml/Document.vala
index ed61ca7..0aad66b 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -32,4 +32,5 @@ public interface GXml.Document : Object, GXml.Node
* { link GXml.Node}.
*/
public abstract GXml.Node create_element (string name);
+ public abstract GXml.Node create_text (string text);
}
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index 290bbc1..3bb86d8 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -133,8 +133,8 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
n.copy (ref a);
}
if (n is Text) {
- var tnode = ((xDocument) doc).create_text_node (n.node_value);
- element.append_child (tnode);
+ var tnode = doc.create_text (n.node_value);
+ element.childs.add (tnode);
}
}
}
@@ -144,11 +144,11 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
string t = "";
if (serialized_xml_node_value != null)
t = serialized_xml_node_value;
- var tn = ((xDocument) doc).create_text_node (t);
+ var tn = doc.create_text (t);
#if DEBUG
stdout.printf (@"SETTING CONTENT FOR: $(get_type ().name ()): $(element.node_name): content '$t'\n");
#endif
- element.append_child (tn);
+ element.childs.add (tn);
}
return element;
}
diff --git a/gxml/libxml-Document.vala b/gxml/libxml-Document.vala
index 525cfc9..183025b 100644
--- a/gxml/libxml-Document.vala
+++ b/gxml/libxml-Document.vala
@@ -1012,7 +1012,6 @@ namespace GXml {
// GXml.Document interface
public GLib.File file { get; set; }
public virtual GXml.Node root { get { return document_element; } }
- /*
- */
+ public GXml.Node create_text (string str) { return (GXml.Node) this.create_text_node (str); }
}
}
diff --git a/gxml/libxml-Text.vala b/gxml/libxml-Text.vala
index 35b76b9..3fc112a 100644
--- a/gxml/libxml-Text.vala
+++ b/gxml/libxml-Text.vala
@@ -1,4 +1,4 @@
-/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* Text.vala
*
* Copyright (C) 2011-2013 Richard Schwarting <aquarichy gmail com>
@@ -99,5 +99,7 @@ namespace GXml {
return other;
}
+ // Interface GXml.Text
+ public string str { get { return this.data; } }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]