[gxml] GomNode renamed to Node
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomNode renamed to Node
- Date: Fri, 5 Jul 2019 20:22:59 +0000 (UTC)
commit ff7650692c99442e3a6ba64b5630922986511b11
Author: Daniel Espinosa <esodan gmail com>
Date: Fri Jul 5 14:25:53 2019 -0500
GomNode renamed to Node
gxml/DomNode.vala | 17 -----------------
gxml/GomAttr.vala | 2 +-
gxml/GomDocument.vala | 6 +++---
gxml/GomElement.vala | 2 +-
gxml/GomText.vala | 2 +-
gxml/{GomNode.vala => Node.vala} | 10 +++++-----
gxml/meson.build | 2 +-
test/DomXDocumentTest.vala | 4 ++--
test/GomElementTest.vala | 8 ++++----
9 files changed, 18 insertions(+), 35 deletions(-)
---
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index 5447c17..10748e4 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -82,23 +82,6 @@ public interface GXml.DomNode : GLib.Object, GXml.DomEventTarget {
public abstract DomNode append_child (DomNode node) throws GLib.Error;
public abstract DomNode replace_child (DomNode node, DomNode child) throws GLib.Error;
public abstract DomNode remove_child (DomNode child) throws GLib.Error;
- public virtual DomNode clone_node (bool deep = false) throws GLib.Error {
- DomNode n = new GomNode ();
- if (owner_document == null) return new GomNode ();
- switch (node_type) {
- case NodeType.ELEMENT_NODE:
- n = owner_document.create_element (node_name);
- copy (owner_document, n, this, true);
- break;
- case NodeType.COMMENT_NODE:
- n = owner_document.create_comment ((this as DomComment).data);
- break;
- case NodeType.TEXT_NODE:
- n = owner_document.create_text_node ((this as DomText).data);
- break;// FIXME: more nodes
- }
- return n;
- }
/**
* Copy a {@link GXml.DomNode} relaying on {@link GXml.DomDocument} to other {@link GXml.DomNode}.
*
diff --git a/gxml/GomAttr.vala b/gxml/GomAttr.vala
index 734372e..81fc17b 100644
--- a/gxml/GomAttr.vala
+++ b/gxml/GomAttr.vala
@@ -26,7 +26,7 @@ using Gee;
/**
* DOM4 implemenation of {@link DomAttr}.
*/
-public class GXml.GomAttr : GXml.GomNode, GXml.DomAttr {
+public class GXml.GomAttr : GXml.Node, GXml.DomAttr {
protected string _namespace_uri;
protected GomProperty prop = null;
public string local_name { owned get { return _local_name; } }
diff --git a/gxml/GomDocument.vala b/gxml/GomDocument.vala
index 4b948b0..a74e1cf 100644
--- a/gxml/GomDocument.vala
+++ b/gxml/GomDocument.vala
@@ -31,7 +31,7 @@ using GXml;
* If you define a property in a derived class with a nick's name '::ROOT' it
* will be initialized and used as root node to parse documents.
*/
-public class GXml.GomDocument : GomNode,
+public class GXml.GomDocument : GXml.Node,
DomParentNode,
DomNonElementParentNode,
DomDocument,
@@ -365,7 +365,7 @@ public class GXml.GomImplementation : GLib.Object, GXml.DomImplementation {
}
-public class GXml.GomDocumentType : GXml.GomNode,
+public class GXml.GomDocumentType : GXml.Node,
GXml.DomChildNode,
GXml.DomDocumentType
{
@@ -409,7 +409,7 @@ public class GXml.GomDocumentType : GXml.GomNode,
}
-public class GXml.GomDocumentFragment : GXml.GomNode,
+public class GXml.GomDocumentFragment : GXml.Node,
GXml.DomParentNode,
GXml.DomNonElementParentNode,
GXml.DomDocumentFragment
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index e873a9c..284f972 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -36,7 +36,7 @@ using Gee;
* just a XML element node and its attributes but not its childs; save its childs
* as a text, for a post-on-step-parsing.
*/
-public class GXml.GomElement : GomNode,
+public class GXml.GomElement : GXml.Node,
DomChildNode,
DomNonDocumentTypeChildNode,
DomParentNode,
diff --git a/gxml/GomText.vala b/gxml/GomText.vala
index f5215fb..959fc8f 100644
--- a/gxml/GomText.vala
+++ b/gxml/GomText.vala
@@ -28,7 +28,7 @@ using GXml;
* This object avoids pre and post XML parsing, by using a one step parsing
* to translate text XML tree to an GObject based tree.
*/
-public class GXml.GomCharacterData : GomNode,
+public class GXml.GomCharacterData : GXml.Node,
DomNonDocumentTypeChildNode,
DomChildNode,
DomCharacterData
diff --git a/gxml/GomNode.vala b/gxml/Node.vala
similarity index 98%
rename from gxml/GomNode.vala
rename to gxml/Node.vala
index bca3177..eaa07f8 100644
--- a/gxml/GomNode.vala
+++ b/gxml/Node.vala
@@ -29,7 +29,7 @@ using Gee;
* This object avoids pre and post XML parsing, by using a one step parsing
* to translate text XML tree to an GObject based tree.
*/
-public class GXml.GomNode : Object,
+public class GXml.Node : Object,
DomEventTarget,
DomNode {
// DomNode
@@ -252,7 +252,7 @@ public class GXml.GomNode : Object,
}
public DomNode insert_before (DomNode node, DomNode? child) throws GLib.Error {
- if (!(node is GXml.GomNode))
+ if (!(node is GXml.Node))
throw new DomError.INVALID_NODE_TYPE_ERROR
(_("Invalid attempt to add invalid node type"));
if (child != null && !this.contains (child))
@@ -285,17 +285,17 @@ public class GXml.GomNode : Object,
return node;
}
public DomNode append_child (DomNode node) throws GLib.Error {
- if (!(node is GomNode))
+ if (!(node is GXml.Node))
throw new DomError.HIERARCHY_REQUEST_ERROR
(_("Node type is invalid. Can't append as child"));
if (owner_document != node.owner_document)
throw new DomError.HIERARCHY_REQUEST_ERROR
(_("Invalid attempt to append a child with different parent document"));
- (node as GomNode).set_parent (this);
+ (node as GXml.Node).set_parent (this);
return insert_before (node, null);
}
public DomNode replace_child (DomNode node, DomNode child) throws GLib.Error {
- if (!(node is GXml.GomNode))
+ if (!(node is GXml.Node))
throw new DomError.INVALID_NODE_TYPE_ERROR (_("Invalid attempt to add invalid node type"));
if (child == null || !this.contains (child))
throw new DomError.NOT_FOUND_ERROR (_("Can't find child node to replace or child have a different
parent"));
diff --git a/gxml/meson.build b/gxml/meson.build
index 7954758..9c7bd37 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -58,7 +58,7 @@ valasources = files ([
'GomHashMap.vala',
'GomHashPairedMap.vala',
'GomHashThreeMap.vala',
- 'GomNode.vala',
+ 'Node.vala',
'GomObject.vala',
'GomProperty.vala',
'GomSchema.vala',
diff --git a/test/DomXDocumentTest.vala b/test/DomXDocumentTest.vala
index 55bf62c..6748a19 100644
--- a/test/DomXDocumentTest.vala
+++ b/test/DomXDocumentTest.vala
@@ -199,12 +199,12 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
assert (e.parent_node.has_child_nodes ());
e.parent_node.normalize ();
assert (e.parent_node.text_content == null);
- var cn = e.clone_node (false) as DomElement;
+ var cn = (e as XElement).clone_node (false) as DomElement;
assert (cn.node_name == "p");
assert (cn.get_attribute ("id") == "p01");
assert (cn.child_nodes != null);
assert (cn.child_nodes.size == 0);
- var cn2 = e.clone_node (true) as DomElement;
+ var cn2 = (e as XElement).clone_node (true) as DomElement;
assert (cn2.node_name == "p");
assert (cn2.get_attribute ("id") == "p01");
assert (cn2.child_nodes != null);
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index 1678188..ed89791 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -213,10 +213,10 @@ class GomElementTest : GXmlTest {
DomDocument doc = null;
try {
doc = new GomDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\"; xmlns:products=\"http://diagonalley.co.uk/products\";><ingredient
products:name=\"spider\"/></magic:Potion></Potions>");
- GXml.GomNode root = (GXml.GomNode) doc.document_element;
+ GXml.Node root = (GXml.Node) doc.document_element;
assert (root != null);
assert (root.node_name == "Potions");
- GXml.GomNode node = (GXml.GomNode) root.child_nodes[0];
+ GXml.Node node = (GXml.Node) root.child_nodes[0];
assert (node != null);
assert (node is DomElement);
assert ((node as DomElement).local_name == "Potion");
@@ -240,10 +240,10 @@ class GomElementTest : GXmlTest {
Test.add_func ("/gxml/gom-element/namespace_uri", () => {
try {
GomDocument doc = new GomDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\";
xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
- GXml.GomNode root = (GXml.GomNode) doc.document_element;
+ GXml.Node root = (GXml.Node) doc.document_element;
assert (root != null);
assert (root.node_name == "Potions");
- GXml.GomNode node = (GXml.GomNode) root.child_nodes[0];
+ GXml.Node node = (GXml.Node) root.child_nodes[0];
assert (node != null);
assert (node is DomElement);
assert ((node as DomElement).local_name == "Potion");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]