[gxml] Element: interface removed
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Element: interface removed
- Date: Thu, 4 Jul 2019 23:43:35 +0000 (UTC)
commit a186066fc5a68d33ff46b04b89b3fff447eac327
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Jul 4 14:19:14 2019 -0500
Element: interface removed
gxml/DomCollections.vala | 2 +-
gxml/Element.vala | 89 ---------------------------------------------
gxml/GXmlDocument.vala | 2 +-
gxml/GXmlElement.vala | 3 +-
gxml/GXmlNode.vala | 4 +-
gxml/Node.vala | 54 +++++++++++++--------------
gxml/meson.build | 1 -
test/GHtmlDocumentTest.vala | 5 ++-
8 files changed, 35 insertions(+), 125 deletions(-)
---
diff --git a/gxml/DomCollections.vala b/gxml/DomCollections.vala
index d9ee510..d1fe240 100644
--- a/gxml/DomCollections.vala
+++ b/gxml/DomCollections.vala
@@ -77,7 +77,7 @@ public interface GXml.DomNodeList : GLib.Object, Gee.BidirList<GXml.DomNode> {
public interface GXml.DomHTMLCollection : GLib.Object, Gee.BidirList<GXml.DomElement> {
public abstract new GXml.DomElement? get_element (int index); // FIXME: See bug #768913
public virtual new GXml.DomElement[] to_array () {
- return (GXml.DomElement[]) ((Gee.Collection<GXml.Element>) this).to_array ();
+ return (GXml.DomElement[]) ((Gee.Collection<GXml.DomElement>) this).to_array ();
}
public virtual int length { get { return (int) size; } }
public virtual DomElement? item (int index) { return this.get ((int) index); }
diff --git a/gxml/GXmlDocument.vala b/gxml/GXmlDocument.vala
index 1568b95..e66423f 100644
--- a/gxml/GXmlDocument.vala
+++ b/gxml/GXmlDocument.vala
@@ -109,7 +109,7 @@ public class GXml.GDocument : GXml.GNode,
int found = 0;
for (int i = 0; i < children_nodes.size; i++) {
GXml.Node n = children_nodes.get (i);
- if (n is GXml.Element) {
+ if (n is GXml.DomElement) {
found++;
if (found == 1)
return n;
diff --git a/gxml/GXmlElement.vala b/gxml/GXmlElement.vala
index 6b86865..5d54439 100644
--- a/gxml/GXmlElement.vala
+++ b/gxml/GXmlElement.vala
@@ -25,13 +25,12 @@
using Gee;
/**
- * DOM4 Class implemeting {@link GXml.Element} and {@link GXml.DomElement} interface,
+ * DOM4 Class implemeting {@link GXml.DomElement} interface,
* powered by libxml-2.0 library.
*/
public class GXml.GElement : GXml.GNonDocumentChildNode,
GXml.DomParentNode,
GXml.DomElement,
- GXml.Element,
GXml.XPathContext
{
public GElement (GDocument doc, Xml.Node *node) {
diff --git a/gxml/GXmlNode.vala b/gxml/GXmlNode.vala
index 1c71664..ef725c8 100644
--- a/gxml/GXmlNode.vala
+++ b/gxml/GXmlNode.vala
@@ -198,7 +198,7 @@ public abstract class GXml.GNode : Object,
if (this is GXml.DomText) return (this as DomText).data;
if (this is GXml.DomProcessingInstruction) return this.@value;
if (this is GXml.DomComment) return this.@value;
- if (this is GXml.Document || this is GXml.Element) {
+ if (this is GXml.Document || this is GXml.DomElement) {
message ("Is Element");
foreach (GXml.Node n in children_nodes) {
if (n is GXml.DomText) {
@@ -210,7 +210,7 @@ public abstract class GXml.GNode : Object,
return t;
}
set {
- if (this is GXml.Document || this is GXml.Element) {
+ if (this is GXml.Document || this is GXml.DomElement) {
var t = this.document.create_text (value);
this.document.children_nodes.add (t);
}
diff --git a/gxml/Node.vala b/gxml/Node.vala
index cfc8b75..9d368cc 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -73,59 +73,59 @@ public interface GXml.Node : Object
return null;
}
/**
- * Search all child {@link GXml.Element} with a given property's name and with
+ * Search all child {@link GXml.DomElement} with a given property's name and with
* value contained in text.
*/
- public virtual GXml.ElementList
+ public virtual GXml.DomElementList
get_elements_by_property_value (string property, string value)
{
- var list = new GXml.ElementList ();
+ var list = new GXml.DomElementList ();
foreach (var child in children_nodes) {
- if (child is GXml.Element) {
- (list as Gee.Collection<Element>).add_all (child.get_elements_by_property_value (property, value) as
Gee.Collection<Element>);
+ if (child is GXml.DomElement) {
+ (list as Gee.Collection<GXml.DomElement>).add_all (child.get_elements_by_property_value (property,
value) as Gee.Collection<GXml.DomElement>);
if (child.attrs == null) continue;
var cls = child.attrs.get (property);
if (cls == null) {
continue;
}
if (value in cls.value)
- list.add ((GXml.Element) child);
+ list.add ((GXml.DomElement) child);
}
}
return list;
}
/**
- * Search all child {@link GXml.Element} with a given name.
+ * Search all child {@link GXml.DomElement} with a given name.
*/
- public virtual GXml.ElementList
+ public virtual GXml.DomElementList
get_elements_by_name (string name)
{
- var list = new GXml.ElementList ();
- if (!(this is GXml.Element || this is GXml.Document)) return list;
+ var list = new GXml.DomElementList ();
+ if (!(this is GXml.DomElement || this is GXml.Document)) return list;
foreach (var child in children_nodes) {
- if (child is GXml.Element) {
- (list as Gee.Collection<Element>).add_all (child.get_elements_by_name (name) as
Gee.Collection<Element>);
+ if (child is GXml.DomElement) {
+ (list as Gee.Collection<GXml.DomElement>).add_all (child.get_elements_by_name (name) as
Gee.Collection<GXml.DomElement>);
if (name == child.name)
- list.add ((GXml.Element) child);
+ list.add ((GXml.DomElement) child);
}
}
return list;
}
/**
- * Search all child {@link GXml.Element} with a given name and namespace URI.
+ * Search all child {@link GXml.DomElement} with a given name and namespace URI.
*/
- public virtual GXml.ElementList
+ public virtual GXml.DomElementList
get_elements_by_name_ns (string name, string? ns)
{
- var list = new GXml.ElementList ();
- if (!(this is GXml.Element || this is GXml.Document)) return list;
+ var list = new GXml.DomElementList ();
+ if (!(this is GXml.DomElement || this is GXml.Document)) return list;
foreach (var child in children_nodes) {
- if (child is GXml.Element) {
- (list as Gee.Collection<Element>).add_all (child.get_elements_by_name (name) as
Gee.Collection<Element>);
+ if (child is GXml.DomElement) {
+ (list as Gee.Collection<GXml.DomElement>).add_all (child.get_elements_by_name (name) as
Gee.Collection<GXml.DomElement>);
if (!(child.namespaces == null && child.namespaces.size != 0
&& ns == null)) continue;
if (name == child.name && child.namespaces.get(0).uri == ns)
- list.add ((GXml.Element) child);
+ list.add ((GXml.DomElement) child);
}
}
return list;
@@ -161,12 +161,12 @@ public interface GXml.Node : Object
* {@link node} could belongs from different {@link GXml.Document}, while source is a node
* belonging to given document.
*
- * Only {@link GXml.Element} objects are supported. For attributes, use
- * {@link GXml.Element.set_attr} method, passing source's name and value as arguments.
+ * Only {@link GXml.DomElement} objects are supported. For attributes, use
+ * {@link GXml.DomElement.set_attr} method, passing source's name and value as arguments.
*
* @param doc a {@link GXml.Document} owning destiny node
- * @param node a {@link GXml.Element} to copy nodes to
- * @param source a {@link GXml.Element} to copy nodes from, it could be holded by different {@link
GXml.Document}
+ * @param node a {@link GXml.DomElement} to copy nodes to
+ * @param source a {@link GXml.DomElement} to copy nodes from, it could be holded by different {@link
GXml.Document}
*/
public static bool copy (GXml.Document doc, GXml.Node node, GXml.Node source, bool deep)
{
@@ -174,20 +174,20 @@ public interface GXml.Node : Object
GLib.message ("Copying GXml.Node");
#endif
if (node is GXml.Document) return false;
- if (source is GXml.Element && node is GXml.Element) {
+ if (source is GXml.DomElement && node is GXml.DomElement) {
#if DEBUG
GLib.message ("Copying source and destiny nodes are GXml.Elements... copying...");
GLib.message ("Copying source's attributes to destiny node");
#endif
foreach (GXml.Node p in source.attrs.values) {
- ((GXml.Element) node).set_attr (p.name, p.value); // TODO: Namespace
+ ((GXml.GElement) node).set_attr (p.name, p.value); // TODO: Namespace
}
if (!deep) return true;
#if DEBUG
GLib.message ("Copying source's child nodes to destiny node");
#endif
foreach (Node c in source.children_nodes) {
- if (c is Element) {
+ if (c is GXml.DomElement) {
if (c.name == null) continue;
#if DEBUG
GLib.message (@"Copying child Element node: $(c.name)");
diff --git a/gxml/meson.build b/gxml/meson.build
index 3a317ba..899e1e4 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -50,7 +50,6 @@ valasources = files ([
'DomMutationObservers.vala',
'DomNode.vala',
'DomRange.vala',
- 'Element.vala',
'Enumeration.vala',
'GHtml.vala',
'GomArrayList.vala',
diff --git a/test/GHtmlDocumentTest.vala b/test/GHtmlDocumentTest.vala
index 0951302..eead0d9 100644
--- a/test/GHtmlDocumentTest.vala
+++ b/test/GHtmlDocumentTest.vala
@@ -36,8 +36,9 @@ class GHtmlDocumentTest : GXmlTest {
var n = doc.get_element_by_id ("user");
assert (n != null);
assert (n.node_name == "p");
- assert (n is GXml.Element);
- assert (((GXml.Element) n).content == "");
+ assert (n is GXml.DomElement);
+ message (((GXml.DomElement) n).text_content);
+ assert (((GXml.DomElement) n).node_value == "");
} catch (GLib.Error e){
Test.message ("ERROR: "+e.message);
assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]