[gxml] Text: interface removed
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Text: interface removed
- Date: Thu, 4 Jul 2019 23:43:00 +0000 (UTC)
commit 397ac7ffcfa82175ef484fc74c2d14c820059d3b
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Jul 4 13:32:29 2019 -0500
Text: interface removed
gxml/GXmlNode.vala | 7 ++++---
gxml/GXmlText.vala | 2 +-
gxml/Node.vala | 2 +-
gxml/Text.vala | 34 ----------------------------------
gxml/meson.build | 1 -
test/DomGDocumentTest.vala | 8 +++++---
6 files changed, 11 insertions(+), 43 deletions(-)
---
diff --git a/gxml/GXmlNode.vala b/gxml/GXmlNode.vala
index 7056849..565403a 100644
--- a/gxml/GXmlNode.vala
+++ b/gxml/GXmlNode.vala
@@ -197,12 +197,13 @@ public abstract class GXml.GNode : Object,
public string? text_content {
owned get {
string t = null;
- if (this is GXml.Text) return this.@value;
+ if (this is GXml.DomText) return (this as DomText).data;
if (this is GXml.ProcessingInstruction) return this.@value;
if (this is GXml.Comment) return this.@value;
if (this is GXml.Document || this is GXml.Element) {
+ message ("Is Element");
foreach (GXml.Node n in children_nodes) {
- if (n is GXml.Text) {
+ if (n is GXml.DomText) {
if (t == null) t = n.value;
else t += n.value;
}
@@ -215,7 +216,7 @@ public abstract class GXml.GNode : Object,
var t = this.document.create_text (value);
this.document.children_nodes.add (t);
}
- if (!(this is GXml.Text || this is GXml.Comment || this is GXml.ProcessingInstruction)) return;
+ if (!(this is GXml.DomText || this is GXml.Comment || this is GXml.ProcessingInstruction)) return;
this.@value = value;
}
}
diff --git a/gxml/GXmlText.vala b/gxml/GXmlText.vala
index 07edcb9..d8e57d0 100644
--- a/gxml/GXmlText.vala
+++ b/gxml/GXmlText.vala
@@ -25,7 +25,7 @@ using Gee;
* DOM4 Class implemeting {@link GXml.Text}
* and {@link DomText} interface, powered by libxml2 library.
*/
-public class GXml.GText : GXml.GCharacterData, GXml.Text, GXml.DomText
+public class GXml.GText : GXml.GCharacterData, GXml.DomText
{
public GText (GDocument doc, Xml.Node *node)
{
diff --git a/gxml/Node.vala b/gxml/Node.vala
index 94fb615..cfc8b75 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -198,7 +198,7 @@ public interface GXml.Node : Object
copy (doc, e, c, deep);
} catch {}
}
- if (c is Text) {
+ if (c is DomText) {
if (c.value == null) {
GLib.warning (_("Text node with NULL string"));
continue;
diff --git a/gxml/meson.build b/gxml/meson.build
index 01c9779..449bb31 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -98,7 +98,6 @@ valasources = files ([
'Parser.vala',
'ProcessingInstruction.vala',
'Schema.vala',
- 'Text.vala',
'XParser.vala',
'XPath.vala'
])
diff --git a/test/DomGDocumentTest.vala b/test/DomGDocumentTest.vala
index 396ce03..d157a72 100644
--- a/test/DomGDocumentTest.vala
+++ b/test/DomGDocumentTest.vala
@@ -166,15 +166,16 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
});
Test.add_func ("/gxml/dom/node", () => {
try {
-#if DEBUG
- GLib.message ("Doc: "+HTMLDOC);
-#endif
var doc = new GDocument.from_string (HTMLDOC) as DomDocument;
assert (doc is DomDocument);
+ message (doc.write_string ());
assert (doc.document_element.children.size == 1);
assert (doc.document_element.children[0] != null);
assert (doc.document_element.children[0].children[1] != null);
var e = doc.document_element.children[0].children[1];
+ assert (e.node_name == "p");
+ assert (e is DomElement);
+ assert ((e as DomElement).get_attribute ("id") == "p01");
assert (e.owner_document == (DomDocument) doc);
assert (e.parent_node != null);
assert (e.parent_node.node_name == "body");
@@ -193,6 +194,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
assert (t.next_sibling == null);
assert (t.text_content != null);
assert (t.text_content == "p01 p id");
+ message ("%s: '%s'", e.parent_node.node_name, e.parent_node.text_content);
assert (e.parent_node.text_content == "\n\n\n\n\n");
assert (e.parent_node.has_child_nodes ());
e.parent_node.normalize ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]