[gxml/gsoc2013] gxml/*.vala: Change all DomNode references to Node
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/gsoc2013] gxml/*.vala: Change all DomNode references to Node
- Date: Sun, 28 Jul 2013 05:31:59 +0000 (UTC)
commit b69d2a4b641036635ab8e9f4eac49ae8ea9b5b5e
Author: Richard Schwarting <aquarichy gmail com>
Date: Sun Jul 28 01:30:10 2013 -0400
gxml/*.vala: Change all DomNode references to Node
gxml/Attr.vala | 18 ++--
gxml/BackedNode.vala | 30 ++++----
gxml/Document.vala | 24 +++---
gxml/DocumentType.vala | 2 +-
gxml/Element.vala | 34 ++++----
gxml/Entity.vala | 14 ++--
gxml/EntityReference.vala | 2 +-
gxml/Implementation.vala | 2 +-
gxml/NamespaceAttr.vala | 2 +-
gxml/Node.vala | 2 +-
gxml/NodeList.vala | 162 +++++++++++++++++++-------------------
gxml/Notation.vala | 2 +-
gxml/ProcessingInstruction.vala | 2 +-
gxml/Serializable.vala | 22 +++---
gxml/Serialization.vala | 36 +++++-----
15 files changed, 177 insertions(+), 177 deletions(-)
---
diff --git a/gxml/Attr.vala b/gxml/Attr.vala
index 6429c59..eed3f85 100644
--- a/gxml/Attr.vala
+++ b/gxml/Attr.vala
@@ -49,7 +49,7 @@ namespace GXml {
* Version: DOM Level 1 Core
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-637646024]]
*/
- public class Attr : DomNode {
+ public class Attr : Node {
/**
* { inheritDoc}
*/
@@ -127,7 +127,7 @@ namespace GXml {
nice to use elem.node->get/set_prop (name[,value]) :S */
get {
this._node_value = "";
- foreach (DomNode child in this.child_nodes) {
+ foreach (Node child in this.child_nodes) {
this._node_value += child.node_value;
// TODO: verify that Attr node's child types'
// node_values are sufficient for building the Attr's value.
@@ -136,7 +136,7 @@ namespace GXml {
}
internal set {
// TODO: consider adding an empty () method to NodeList
- foreach (DomNode child in this.child_nodes) {
+ foreach (Node child in this.child_nodes) {
// TODO: this doesn't clear the actual underlying attributes' values,
is this what we want to do? It works if we eventually sync up values
this.remove_child (child);
}
@@ -149,7 +149,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- /* already doc'd in DomNode */
+ /* already doc'd in Node */
public override NodeList? child_nodes {
owned get {
// TODO: always create a new one?
@@ -220,25 +220,25 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
+ public override Node? insert_before (Node new_child, Node? ref_child) {
return this.child_nodes.insert_before (new_child, ref_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ public override Node? replace_child (Node new_child, Node old_child) {
return this.child_nodes.replace_child (new_child, old_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? remove_child (DomNode old_child) {
+ public override Node? remove_child (Node old_child) {
return this.child_nodes.remove_child (old_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? append_child (DomNode new_child) {
+ public override Node? append_child (Node new_child) {
return this.child_nodes.append_child (new_child);
}
/**
@@ -250,7 +250,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? clone_node (bool deep) {
+ public override Node? clone_node (bool deep) {
return this; // STUB
}
}
diff --git a/gxml/BackedNode.vala b/gxml/BackedNode.vala
index 2db3bbb..098b19e 100644
--- a/gxml/BackedNode.vala
+++ b/gxml/BackedNode.vala
@@ -33,7 +33,7 @@ namespace GXml {
* This would normally be hidden, but Vala wants base classes
* to be at least as public as subclasses.
*/
- public class BackedNode : DomNode {
+ public class BackedNode : Node {
/** Private properties */
internal Xml.Node *node;
@@ -43,7 +43,7 @@ namespace GXml {
// Considered using node->doc instead, but some subclasses don't have corresponding
Xml.Nodes
this.node = node;
- // Save the correspondence between this Xml.Node* and its DomNode
+ // Save the correspondence between this Xml.Node* and its Node
owner.node_dict.insert (node, this);
// TODO: Consider checking whether the Xml.Node* is already recorded. It shouldn't
be.
}
@@ -158,11 +158,11 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? parent_node {
+ public override Node? parent_node {
get {
return this.owner_document.lookup_node (this.node->parent);
// TODO: is parent never null? parent is probably possible to be null, like
when you create a new element unattached
- // return new DomNode (this.node->parent);
+ // return new Node (this.node->parent);
// TODO: figure out whether we really want to recreate wrapper objects each
time
}
internal set {
@@ -184,11 +184,11 @@ namespace GXml {
}
}
- private DomNode? _first_child;
+ private Node? _first_child;
/**
* { inheritDoc}
*/
- public override DomNode? first_child {
+ public override Node? first_child {
get {
_first_child = this.child_nodes.first ();
return _first_child;
@@ -198,11 +198,11 @@ namespace GXml {
}
}
- private DomNode? _last_child;
+ private Node? _last_child;
/**
* { inheritDoc}
*/
- public override DomNode? last_child {
+ public override Node? last_child {
get {
_last_child = this.child_nodes.last ();
return _last_child;
@@ -214,7 +214,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? previous_sibling {
+ public override Node? previous_sibling {
get {
return this.owner_document.lookup_node (this.node->prev);
}
@@ -224,7 +224,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? next_sibling {
+ public override Node? next_sibling {
get {
return this.owner_document.lookup_node (this.node->next);
}
@@ -249,25 +249,25 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
+ public override Node? insert_before (Node new_child, Node? ref_child) {
return this.child_nodes.insert_before (new_child, ref_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ public override Node? replace_child (Node new_child, Node old_child) {
return this.child_nodes.replace_child (new_child, old_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? remove_child (DomNode old_child) /*throws DomError*/ {
+ public override Node? remove_child (Node old_child) /*throws DomError*/ {
return this.child_nodes.remove_child (old_child);
}
/**
* { inheritDoc}
*/
- public override DomNode? append_child (DomNode new_child) /*throws DomError*/ {
+ public override Node? append_child (Node new_child) /*throws DomError*/ {
if (new_child.owner_document != this.owner_document && new_child.get_type ().is_a
(typeof (GXml.BackedNode))) {
/* The point here is that a node from another document should
have a copy made to be integrated into this one, so we don't
@@ -291,7 +291,7 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public override DomNode? clone_node (bool deep) {
+ public override Node? clone_node (bool deep) {
return this; // STUB
}
diff --git a/gxml/Document.vala b/gxml/Document.vala
index 8049ee2..6832782 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -65,7 +65,7 @@ namespace GXml {
}
/**
- * Represents an XML Document as a tree of { link GXml.DomNode}s.
+ * Represents an XML Document as a tree of { link GXml.Node}s.
*
* The Document has a document element, which is the root of
* the tree. A Document can have its type defined by a
@@ -74,18 +74,18 @@ namespace GXml {
* Version: DOM Level 1 Core
* URL: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#i-Document]]
*/
- public class Document : DomNode {
+ public class Document : Node {
/* *** Private properties *** */
/**
* This contains a map of Xml.Nodes that have been
- * accessed and the GXml DomNode we created to represent
- * them on-demand. That way, we don't create an DomNode
+ * accessed and the GXml Node we created to represent
+ * them on-demand. That way, we don't create an Node
* for EVERY node, even if the user never actually
* accesses it.
*/
- internal HashTable<Xml.Node*, DomNode> node_dict = new HashTable<Xml.Node*, DomNode>
(GLib.direct_hash, GLib.direct_equal);
- // We don't want want to use DomNode's Xml.Node or its dict
+ internal HashTable<Xml.Node*, Node> node_dict = new HashTable<Xml.Node*, Node>
(GLib.direct_hash, GLib.direct_equal);
+ // We don't want want to use Node's Xml.Node or its dict
// internal HashTable<Xml.Attr*, Attr> attr_dict = new HashTable<Xml.Attr*, Attr> (null,
null);
/**
@@ -108,8 +108,8 @@ namespace GXml {
internal Xml.Doc *xmldoc;
/* *** Private methods *** */
- internal unowned DomNode? lookup_node (Xml.Node *xmlnode) {
- unowned DomNode domnode;
+ internal unowned Node? lookup_node (Xml.Node *xmlnode) {
+ unowned Node domnode;
if (xmlnode == null) {
return null; // TODO: consider throwing an error instead
@@ -117,7 +117,7 @@ namespace GXml {
domnode = this.node_dict.lookup (xmlnode);
if (domnode == null) {
- // If we don't have a cached the appropriate DomNode for a given Xml.Node*
yet, create it (type matters)
+ // If we don't have a cached the appropriate Node for a given Xml.Node* yet,
create it (type matters)
// TODO: see if we can attach logic to the enum {} to handle this
switch ((NodeType)xmlnode->type) {
case NodeType.ELEMENT:
@@ -261,7 +261,7 @@ namespace GXml {
this ();
this.implementation = impl;
- DomNode root;
+ Node root;
root = this.create_element (qualified_name); // TODO: we do not currently support
namespaces, but when we do, this new node will want one
this.append_child (root);
@@ -675,7 +675,7 @@ namespace GXml {
return str;
}
- /*** DomNode methods ***/
+ /*** Node methods ***/
/**
* Appends new_child to this document. A document can
@@ -687,7 +687,7 @@ namespace GXml {
* Version: DOM Level 1 Core
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-appendChild]]
*/
- public override DomNode? append_child (DomNode new_child) {
+ public override Node? append_child (Node new_child) {
this.check_wrong_document (new_child);
this.check_read_only ();
diff --git a/gxml/DocumentType.vala b/gxml/DocumentType.vala
index 585d27e..8883b3e 100644
--- a/gxml/DocumentType.vala
+++ b/gxml/DocumentType.vala
@@ -29,7 +29,7 @@ namespace GXml {
*
* For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-412266927]]
*/
- public class DocumentType : DomNode {
+ public class DocumentType : Node {
private Xml.Dtd *int_subset;
private Xml.Dtd *ext_subset;
diff --git a/gxml/Element.vala b/gxml/Element.vala
index f71a872..1a317a0 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -33,7 +33,7 @@ namespace GXml {
* These can have child nodes
* of various types including other Elements. Elements can
* have Attr attributes associated with them. Elements have
- * tag names. In addition to methods inherited from DomNode,
+ * tag names. In addition to methods inherited from Node,
* Elements have additional methods for manipulating
* attributes, as an alternative to manipulating the
* attributes HashMap directly.
@@ -338,7 +338,7 @@ namespace GXml {
}
// TODO: consider making the life of TagNameNodeLists optional, and dead by default, at the
Document level
- private void check_add_tag_name (Element basenode, DomNode child) {
+ private void check_add_tag_name (Element basenode, Node child) {
// TODO: make sure there aren't any other NodeTypes that could have elements as
children
if (child.node_type == NodeType.ELEMENT || child.node_type ==
NodeType.DOCUMENT_FRAGMENT) {
// the one we're examining is an element, and might need to be added
@@ -347,7 +347,7 @@ namespace GXml {
}
// if we're adding an element with descendants, or a document fragment, they
might contain nodes that should go into a tag name node list for an ancestor node
- foreach (DomNode grand_child in child.child_nodes) {
+ foreach (Node grand_child in child.child_nodes) {
check_add_tag_name (basenode, grand_child);
}
}
@@ -357,38 +357,38 @@ namespace GXml {
* are elements. If they are, we check the basenode and its ancestors to see
* whether they're keeping that node in a TagNameNodeList, so we can remove it.
*/
- private void check_remove_tag_name (Element basenode, DomNode child) {
+ private void check_remove_tag_name (Element basenode, Node child) {
// TODO: make sure there aren't any other NodeTypes that could have elements as
children
if (child.node_type == NodeType.ELEMENT) {
// the one we're examining is an element, and might need to be removed from a
tag name node list
basenode.on_remove_descendant_with_tag_name ((Element)child);
// if we're removing an element with descendants, it might contain nodes that
should also be removed from a tag name node list for an ancestor node
- foreach (DomNode grand_child in child.child_nodes) {
+ foreach (Node grand_child in child.child_nodes) {
check_remove_tag_name (basenode, grand_child);
}
}
}
- /* ** DomNode methods ** */
- public override DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
- DomNode ret = base.insert_before (new_child, ref_child);
+ /* ** Node methods ** */
+ public override Node? insert_before (Node new_child, Node? ref_child) {
+ Node ret = base.insert_before (new_child, ref_child);
check_add_tag_name (this, new_child);
return ret;
}
- public override DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ public override Node? replace_child (Node new_child, Node old_child) {
check_remove_tag_name (this, old_child);
- DomNode ret = base.replace_child (new_child, old_child);
+ Node ret = base.replace_child (new_child, old_child);
check_add_tag_name (this, new_child);
return ret;
}
- public override DomNode? remove_child (DomNode old_child) {
+ public override Node? remove_child (Node old_child) {
check_remove_tag_name (this, old_child);
- DomNode ret = base.remove_child (old_child);
+ Node ret = base.remove_child (old_child);
return ret;
}
- public override DomNode? append_child (DomNode new_child) {
- DomNode ret = base.append_child (new_child);
+ public override Node? append_child (Node new_child) {
+ Node ret = base.append_child (new_child);
check_add_tag_name (this, new_child);
return ret;
}
@@ -447,7 +447,7 @@ namespace GXml {
private void on_remove_descendant_with_tag_name (Element elem) {
foreach (TagNameNodeList list in tag_name_lists) {
if (elem.tag_name == list.tag_name) {
- foreach (DomNode tag_elem in list) {
+ foreach (Node tag_elem in list) {
if (((Element)tag_elem) == elem) {
list.remove_child (tag_elem);
break;
@@ -479,7 +479,7 @@ namespace GXml {
*/
public NodeList get_elements_by_tag_name (string tag_name) {
TagNameNodeList tagged = new TagNameNodeList (tag_name, this, this.owner_document);
- //List<DomNode> tagged = new List<DomNode> ();
+ //List<Node> tagged = new List<Node> ();
Queue<Xml.Node*> tocheck = new Queue<Xml.Node*> ();
/* TODO: find out whether we are supposed to include this element,
@@ -518,7 +518,7 @@ namespace GXml {
// will be a problem, given that it will
// have a different .node_type
- foreach (DomNode child in this.child_nodes) {
+ foreach (Node child in this.child_nodes) {
switch (child.node_type) {
case NodeType.ELEMENT:
((Element)child).normalize ();
diff --git a/gxml/Entity.vala b/gxml/Entity.vala
index b36ed09..bebd0f0 100644
--- a/gxml/Entity.vala
+++ b/gxml/Entity.vala
@@ -29,7 +29,7 @@ namespace GXml {
*
* For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-11C98490]]
*/
- public class Entity : DomNode {
+ public class Entity : Node {
private Xml.Entity *entity;
/**
@@ -88,7 +88,7 @@ namespace GXml {
}
- public override DomNode? parent_node {
+ public override Node? parent_node {
get {
return this.owner_document.doctype;
// TODO: could this be differen tfrom this.entity->parent?
@@ -109,22 +109,22 @@ namespace GXml {
}
/* Public methods (Node-specific) */
- public override DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
+ public override Node? insert_before (Node new_child, Node? ref_child) {
return this.child_nodes.insert_before (new_child, ref_child);
}
- public override DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ public override Node? replace_child (Node new_child, Node old_child) {
return this.child_nodes.replace_child (new_child, old_child);
}
- public override DomNode? remove_child (DomNode old_child) {
+ public override Node? remove_child (Node old_child) {
return this.child_nodes.remove_child (old_child);
}
- public override DomNode? append_child (DomNode new_child) {
+ public override Node? append_child (Node new_child) {
return this.child_nodes.append_child (new_child);
}
public override bool has_child_nodes () {
return (this.child_nodes.length > 0);
}
- public override DomNode? clone_node (bool deep) {
+ public override Node? clone_node (bool deep) {
return this; // STUB
}
diff --git a/gxml/EntityReference.vala b/gxml/EntityReference.vala
index 84da3f1..5284323 100644
--- a/gxml/EntityReference.vala
+++ b/gxml/EntityReference.vala
@@ -38,7 +38,7 @@ namespace GXml {
* For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-11C98490]]
*/
// TODO: make sure that character entity references (like the one used in the example above, are valid
- public class EntityReference : DomNode {
+ public class EntityReference : Node {
internal EntityReference (string refname, Document doc) {
// TODO: may want to handle refname differently
base (NodeType.ENTITY_REFERENCE, doc); // TODO: what should we pass up?
diff --git a/gxml/Implementation.vala b/gxml/Implementation.vala
index 6daa496..43ee2b5 100644
--- a/gxml/Implementation.vala
+++ b/gxml/Implementation.vala
@@ -67,7 +67,7 @@ namespace GXml {
}
}
- // Not using DomNode's, because this doctype shouldn't have ANY owner yet
+ // Not using Node's, because this doctype shouldn't have ANY owner yet
protected void check_wrong_document (DocumentType? doctype) {
if (doctype != null && doctype.owner_document != null) {
GXml.warning (DomException.WRONG_DOCUMENT, "The supplied doctype is already
connected to an existing document.");
diff --git a/gxml/NamespaceAttr.vala b/gxml/NamespaceAttr.vala
index e527bec..79b9f5a 100644
--- a/gxml/NamespaceAttr.vala
+++ b/gxml/NamespaceAttr.vala
@@ -30,7 +30,7 @@ namespace GXml {
* prefix=uri pairs that define namespaces for XML Elements
* and Attrs.
*/
- public class NamespaceAttr : DomNode {
+ public class NamespaceAttr : Node {
/** Private properties */
private Xml.Ns *node;
diff --git a/gxml/Node.vala b/gxml/Node.vala
index 3e92094..8da9c95 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -1,5 +1,5 @@
/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* DomNode.vala
+/* Node.vala
*
* Copyright (C) 2011-2013 Richard Schwarting <aquarichy gmail com>
* Copyright (C) 2011 Daniel Espinosa <esodan gmail com>
diff --git a/gxml/NodeList.vala b/gxml/NodeList.vala
index 75cd969..1ef6a66 100644
--- a/gxml/NodeList.vala
+++ b/gxml/NodeList.vala
@@ -27,9 +27,9 @@ using Gee;
namespace GXml {
/**
- * A live list used to store { link GXml.DomNode}s.
+ * A live list used to store { link GXml.Node}s.
*
- * Usually contains the children of a { link GXml.DomNode}, or
+ * Usually contains the children of a { link GXml.Node}, or
* the results of { link GXml.Element.get_elements_by_tag_name}.
* { link GXml.NodeList} implements both the DOM Level 1 Core API for
* a NodeList, as well as the { link GLib.List} API, to make
@@ -41,7 +41,7 @@ namespace GXml {
* Version: DOM Level 1 Core
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-536297177]]
*/
- public interface NodeList : Gee.Iterable<DomNode> {
+ public interface NodeList : Gee.Iterable<Node> {
/* NOTE:
* children should define constructors like:
* internal NodeList (Xml.Node* head, Document owner);
@@ -66,7 +66,7 @@ namespace GXml {
* Version: DOM Level 1 Core
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-item]]
*/
- public abstract DomNode item (ulong idx);
+ public abstract Node item (ulong idx);
/* ** GNOME List conventions **
@@ -77,52 +77,52 @@ namespace GXml {
/**
* Call the provided func on each item of the list.
*/
- public abstract void foreach (Func<DomNode> func);
+ public abstract void foreach (Func<Node> func);
// TODO: add hints for performance below, perhaps
/**
* Retrieve the first node in the list.
*/
- public abstract DomNode first ();
+ public abstract Node first ();
/**
* Retrieve the last node in the list.
*/
- public abstract DomNode last ();
+ public abstract Node last ();
/**
* Obtain the n'th item in the list. Used for compatibility with GLib.List.
*/
- public abstract DomNode? nth (ulong n);
+ public abstract Node? nth (ulong n);
/**
* Obtain the n'th item in the list. Used for compatibility with GLib.List.
*/
- public abstract DomNode? nth_data (ulong n);
+ public abstract Node? nth_data (ulong n);
/**
* Obtain the item n places before pivot in the list.
*/
- public abstract DomNode? nth_prev (DomNode pivot, ulong n);
+ public abstract Node? nth_prev (Node pivot, ulong n);
/**
* Obtain index for node target in the list.
*/
- public abstract int find (DomNode target);
+ public abstract int find (Node target);
/**
* Obtain index for node target in the list, using CompareFunc to compare.
*/
- public abstract int find_custom (DomNode target, CompareFunc<DomNode> cmp);
+ public abstract int find_custom (Node target, CompareFunc<Node> cmp);
/**
* Obtain index for node target in the list.
*/
- public abstract int position (DomNode target);
+ public abstract int position (Node target);
/**
* Obtain index for node target in the list.
*/
- public abstract int index (DomNode target);
+ public abstract int index (Node target);
// TODO: wow, lots of those GList compatibility methods are the same in a case like this.
/* These exist to support management of a node's children */
- internal abstract DomNode? insert_before (DomNode new_child, DomNode? ref_child);
- internal abstract DomNode? replace_child (DomNode new_child, DomNode old_child);
- internal abstract DomNode? remove_child (DomNode old_child);
- internal abstract DomNode? append_child (DomNode new_child);
+ internal abstract Node? insert_before (Node new_child, Node? ref_child);
+ internal abstract Node? replace_child (Node new_child, Node old_child);
+ internal abstract Node? remove_child (Node old_child);
+ internal abstract Node? append_child (Node new_child);
/**
* Creates an XML string representation of the nodes in the list.
@@ -138,17 +138,17 @@ namespace GXml {
/**
* This provides a NodeList that is backed by a GLib.List of
- * DomNodes. A root { link GXml.DomNode} is specified, which
+ * Nodes. A root { link GXml.Node} is specified, which
* is usually the owner/parent of the list's contents
* (children of the parent).
*/
- internal class GListNodeList : Gee.Traversable<DomNode>, Gee.Iterable<DomNode>, NodeList, GLib.Object
{
- internal DomNode root;
- internal GLib.List<DomNode> nodes;
+ internal class GListNodeList : Gee.Traversable<Node>, Gee.Iterable<Node>, NodeList, GLib.Object {
+ internal Node root;
+ internal GLib.List<Node> nodes;
- internal GListNodeList (DomNode root) {
+ internal GListNodeList (Node root) {
this.root = root;
- this.nodes = new GLib.List<DomNode> ();
+ this.nodes = new GLib.List<Node> ();
}
/**
@@ -165,87 +165,87 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public DomNode item (ulong idx) {
+ public Node item (ulong idx) {
return this.nth_data (idx);
}
/**
* { inheritDoc}
*/
- public bool foreach (ForallFunc<DomNode> func) {
+ public bool foreach (ForallFunc<Node> func) {
return iterator ().foreach (func);
}
/**
* { inheritDoc}
*/
- public DomNode first () {
+ public Node first () {
return this.nodes.first ().data;
}
/**
* { inheritDoc}
*/
- public DomNode last () {
+ public Node last () {
return this.nodes.last ().data;
}
/**
* { inheritDoc}
*/
- public DomNode? nth (ulong n) {
+ public Node? nth (ulong n) {
return this.nth_data (n);
}
/**
* { inheritDoc}
*/
- public DomNode? nth_data (ulong n) {
+ public Node? nth_data (ulong n) {
return this.nodes.nth_data ((uint)n);
}
/**
* { inheritDoc}
*/
- public DomNode? nth_prev (DomNode pivot, ulong n) {
- unowned GLib.List<DomNode> list_pivot = this.nodes.find (pivot);
+ public Node? nth_prev (Node pivot, ulong n) {
+ unowned GLib.List<Node> list_pivot = this.nodes.find (pivot);
return list_pivot.nth_prev ((uint)n).data;
}
/**
* { inheritDoc}
*/
- public int find (DomNode target) {
+ public int find (Node target) {
return this.index (target);
}
/**
* { inheritDoc}
*/
- public int find_custom (DomNode target, CompareFunc<DomNode> cmp) {
- unowned GLib.List<DomNode> list_pt = this.nodes.find_custom (target, cmp);
+ public int find_custom (Node target, CompareFunc<Node> cmp) {
+ unowned GLib.List<Node> list_pt = this.nodes.find_custom (target, cmp);
return this.index (list_pt.data);
}
/**
* { inheritDoc}
*/
- public int position (DomNode target) {
+ public int position (Node target) {
return this.index (target);
}
/**
* { inheritDoc}
*/
- public int index (DomNode target) {
+ public int index (Node target) {
return this.nodes.index (target);
}
- internal DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
+ internal Node? insert_before (Node new_child, Node? ref_child) {
this.nodes.insert_before (this.nodes.find (ref_child), new_child);
return new_child;
}
- internal DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ internal Node? replace_child (Node new_child, Node old_child) {
int pos = this.index (old_child);
this.remove_child (old_child);
this.nodes.insert (new_child, pos);
return old_child;
}
- internal DomNode? remove_child (DomNode old_child) /*throws DomError*/ {
+ internal Node? remove_child (Node old_child) /*throws DomError*/ {
this.nodes.remove (old_child);
return old_child;
}
- internal DomNode? append_child (DomNode new_child) /*throws DomError*/ {
+ internal Node? append_child (Node new_child) /*throws DomError*/ {
this.nodes.append (new_child);
return new_child;
}
@@ -253,7 +253,7 @@ namespace GXml {
public string to_string (bool in_line) {
string str = "";
- foreach (DomNode node in this.nodes) {
+ foreach (Node node in this.nodes) {
str += node.to_string ();
}
@@ -263,10 +263,10 @@ namespace GXml {
/* ** Iterable methods ***/
public GLib.Type element_type {
get {
- return typeof (DomNode);
+ return typeof (Node);
}
}
- public Gee.Iterator<DomNode> iterator () {
+ public Gee.Iterator<Node> iterator () {
return new NodeListIterator (this);
}
@@ -286,9 +286,9 @@ namespace GXml {
* remove () always fails (does nothing)
*/
- private unowned GLib.List<DomNode> cur;
- private unowned GLib.List<DomNode> first_node;
- private unowned GLib.List<DomNode> next_node;
+ private unowned GLib.List<Node> cur;
+ private unowned GLib.List<Node> first_node;
+ private unowned GLib.List<Node> next_node;
public NodeListIterator (GListNodeList list) {
this.cur = null;
@@ -296,7 +296,7 @@ namespace GXml {
this.next_node = list.nodes;
}
- protected override DomNode get_current () {
+ protected override Node get_current () {
return this.cur.data;
}
@@ -317,7 +317,7 @@ namespace GXml {
* time, or get reconstructed-on-the-go?
*/
internal class TagNameNodeList : GListNodeList { internal string tag_name;
- internal TagNameNodeList (string tag_name, DomNode root, Document owner) {
+ internal TagNameNodeList (string tag_name, Node root, Document owner) {
base (root);
this.tag_name = tag_name;
}
@@ -326,7 +326,7 @@ namespace GXml {
/* TODO: warning: this list should NOT be edited :(
we need a new, better live AttrNodeList :| */
internal class AttrNodeList : GListNodeList {
- internal AttrNodeList (DomNode root, Document owner) {
+ internal AttrNodeList (Node root, Document owner) {
base (root);
base.nodes = root.attributes.get_values ();
}
@@ -431,7 +431,7 @@ namespace GXml {
// TODO: Desperately want to extend List or implement relevant interfaces to make iterable
// TODO: remember that the order of interfaces that you're listing as implemented matters
- internal abstract class ChildNodeList : Gee.Traversable<DomNode>, Gee.Iterable<DomNode>, NodeList,
GLib.Object {
+ internal abstract class ChildNodeList : Gee.Traversable<Node>, Gee.Iterable<Node>, NodeList,
GLib.Object {
/* TODO: must be live
if this reflects children of a node, then must always be current
same with nodes from GetElementByTagName, made need separate impls for each */
@@ -459,17 +459,17 @@ namespace GXml {
/**
* { inheritDoc}
*/
- public DomNode item (ulong idx) {
+ public Node item (ulong idx) {
return this.nth (idx);
}
/** Iterable methods **/
public GLib.Type element_type { // TODO: should we need to use the override keyword when
implementing interfaces
get {
- return typeof(DomNode);
+ return typeof(Node);
}
}
- public Gee.Iterator<DomNode> iterator () {
+ public Gee.Iterator<Node> iterator () {
return new NodeListIterator (this);
}
@@ -477,30 +477,30 @@ namespace GXml {
/** GNOME List conventions
** Probably don't want to keep all of them since they're not all relevant.
**/
- public bool foreach (ForallFunc<DomNode> func) {
+ public bool foreach (ForallFunc<Node> func) {
return iterator ().foreach (func);
}
- public DomNode first () {
+ public Node first () {
return this.owner.lookup_node (head);
}
- public DomNode last () {
+ public Node last () {
Xml.Node *cur = head;
while (cur != null && cur->next != null) {
cur = cur->next;
}
return this.owner.lookup_node (cur); // TODO :check for nulls?
}
- public DomNode? nth (ulong n) {
+ public Node? nth (ulong n) {
Xml.Node *cur = head;
for (int i = 0; i < n && cur != null; i++) {
cur = cur->next;
}
return this.owner.lookup_node (cur);
}
- public DomNode? nth_data (ulong n) {
+ public Node? nth_data (ulong n) {
return nth (n);
}
- public DomNode? nth_prev (DomNode pivot, ulong n) {
+ public Node? nth_prev (Node pivot, ulong n) {
Xml.Node *cur;
for (cur = head; cur != null && this.owner.lookup_node (cur) != pivot; cur =
cur->next) {
}
@@ -512,7 +512,7 @@ namespace GXml {
}
return this.owner.lookup_node (cur);
}
- public int find (DomNode target) {
+ public int find (Node target) {
int pos = 0;
Xml.Node *cur;
for (cur = head; cur != null && this.owner.lookup_node (cur) != target; cur =
cur->next) {
@@ -524,7 +524,7 @@ namespace GXml {
return pos;
}
}
- public int find_custom (DomNode target, CompareFunc<DomNode> cmp) {
+ public int find_custom (Node target, CompareFunc<Node> cmp) {
int pos = 0;
Xml.Node *cur;
for (cur = head; cur != null && cmp (this.owner.lookup_node (cur), target) != 0; cur
= cur->next) {
@@ -536,15 +536,15 @@ namespace GXml {
return pos;
}
}
- public int position (DomNode target) {
+ public int position (Node target) {
return find (target);
}
- public int index (DomNode target) {
+ public int index (Node target) {
return find (target);
}
/** Node's child methods, implemented here **/
- internal new DomNode? insert_before (DomNode new_child, DomNode? ref_child) {
+ internal new Node? insert_before (Node new_child, Node? ref_child) {
Xml.Node *child = head;
if (ref_child == null) {
@@ -559,7 +559,7 @@ namespace GXml {
return null;
} else {
if (new_child.node_type == NodeType.DOCUMENT_FRAGMENT) {
- foreach (DomNode new_grand_child in new_child.child_nodes) {
+ foreach (Node new_grand_child in new_child.child_nodes) {
child->add_prev_sibling (((BackedNode)new_grand_child).node);
}
} else {
@@ -569,13 +569,13 @@ namespace GXml {
return new_child;
}
- internal new DomNode? replace_child (DomNode new_child, DomNode old_child) {
+ internal new Node? replace_child (Node new_child, Node old_child) {
// TODO: verify that libxml2 already removes
// new_child first if it is found elsewhere in
// the tree.
// TODO: nuts, if Node as an iface can't have properties,
- // then I have to cast these to DomNodes, ugh.
+ // then I have to cast these to Nodes, ugh.
// TODO: need to handle errors?
// TODO: want to do a 'find_child' function
@@ -599,20 +599,20 @@ namespace GXml {
return old_child;
}
- internal new DomNode? remove_child (DomNode old_child) /* throws DomError */ {
+ internal new Node? remove_child (Node old_child) /* throws DomError */ {
// TODO: verify that old_child is a valid child here and then unlink
((BackedNode)old_child).node->unlink (); // TODO: do we need to free libxml2 stuff
manually?
return old_child;
}
- internal virtual DomNode? append_child (DomNode new_child) /* throws DomError */ {
+ internal virtual Node? append_child (Node new_child) /* throws DomError */ {
// TODO: verify that libxml2 will first remove
// new_child if it already exists elsewhere in
// the tree.
if (new_child.node_type == NodeType.DOCUMENT_FRAGMENT) {
- foreach (DomNode grand_child in new_child.child_nodes) {
+ foreach (Node grand_child in new_child.child_nodes) {
parent_as_xmlnode->add_child (((BackedNode)grand_child).node);
}
} else {
@@ -625,7 +625,7 @@ namespace GXml {
private string _str;
public string to_string (bool in_line = true) {
_str = "";
- foreach (DomNode node in this) {
+ foreach (Node node in this) {
_str += node.to_string ();
}
return _str;
@@ -650,7 +650,7 @@ namespace GXml {
/* ** model-specific methods ***/
- protected override DomNode get_current () {
+ protected override Node get_current () {
return this.doc.lookup_node (this.cur);
}
@@ -665,12 +665,12 @@ namespace GXml {
}
}
- private abstract class GenericNodeListIterator : Gee.Traversable<DomNode>, Gee.Iterator<DomNode>,
GLib.Object {
- protected abstract DomNode get_current ();
+ private abstract class GenericNodeListIterator : Gee.Traversable<Node>, Gee.Iterator<Node>,
GLib.Object {
+ protected abstract Node get_current ();
protected abstract bool is_empty ();
protected abstract void advance ();
- public bool foreach (ForallFunc<DomNode> f) {
+ public bool foreach (ForallFunc<Node> f) {
var r = this.get ();
bool ret = f(r);
if (ret && this.next ())
@@ -682,23 +682,23 @@ namespace GXml {
/* ** Iterator methods ***/
/**
- * Obtain the current DomNode in the iteration.
+ * Obtain the current Node in the iteration.
* Returns null if there is none, which occurs
* if the list is empty or if iteration has
* not started (next () has never been
* called).
*/
- public new DomNode get () {
+ public new Node get () {
if (this.valid) {
return this.get_current ();
} else {
- // TODO: file bug, Iterator wants DomNode, not DomNode?, but it wants us to
be able to return null.
+ // TODO: file bug, Iterator wants Node, not Node?, but it wants us to be able
to return null.
return null;
}
}
/**
- * Advance to the next DomNode in the list
+ * Advance to the next Node in the list
*/
public bool next () {
if (this.is_empty ()) {
@@ -711,7 +711,7 @@ namespace GXml {
}
/**
- * Checks whether there is a next DomNode in the list.
+ * Checks whether there is a next Node in the list.
*/
public bool has_next () {
return (! this.is_empty ());
diff --git a/gxml/Notation.vala b/gxml/Notation.vala
index c98a05e..c96ee48 100644
--- a/gxml/Notation.vala
+++ b/gxml/Notation.vala
@@ -32,7 +32,7 @@ namespace GXml {
* ProcessingInstruction targets.
* For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-5431D1B9]]
*/
- public class Notation : DomNode {
+ public class Notation : Node {
// private Xml.Notation *notation; // TODO: wrap libxml's xmlNotation
/**
diff --git a/gxml/ProcessingInstruction.vala b/gxml/ProcessingInstruction.vala
index 1edc05b..44b930f 100644
--- a/gxml/ProcessingInstruction.vala
+++ b/gxml/ProcessingInstruction.vala
@@ -40,7 +40,7 @@ namespace GXml {
* {{{<?pi_target processing instruction data?>}}}
* For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1004215813]]
*/
- public class ProcessingInstruction : DomNode {
+ public class ProcessingInstruction : Node {
internal ProcessingInstruction (string target, string data, Document doc) {
base (NodeType.PROCESSING_INSTRUCTION, doc); // TODO: want to pass a real Xml.Node* ?
this.target = target;
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index 7687032..53ac7fc 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -75,10 +75,10 @@ namespace GXml {
* Interface method to handle deserialization of an
* individual property. The implementing class
* receives a description of the property and the
- * { link GXml.DomNode} that contains the content. The
+ * { link GXml.Node} that contains the content. The
* implementing { link GXml.Serializable} object can extract
- * the data from the { link GXml.DomNode} and store it in its
- * property itself. Note that the { link GXml.DomNode} may be
+ * the data from the { link GXml.Node} and store it in its
+ * property itself. Note that the { link GXml.Node} may be
* as simple as a { link GXml.Text} that stores the data as a
* string.
*
@@ -92,7 +92,7 @@ namespace GXml {
*
* @param property_name the name of the property as a string
* @param spec the { link GLib.ParamSpec} describing the property.
- * @param property_node the { link GXml.DomNode} encapsulating data to deserialize
+ * @param property_node the { link GXml.Node} encapsulating data to deserialize
* @return `true` if the property was handled, `false` if { link GXml.Serialization} should
handle it.
*/
/*
@@ -100,7 +100,7 @@ namespace GXml {
* letting them get name from spec
* @todo: consider returning { link GLib.Value} as out param
*/
- public virtual bool deserialize_property (string property_name, /* out GLib.Value value,*/
GLib.ParamSpec spec, GXml.DomNode property_node) {
+ public virtual bool deserialize_property (string property_name, /* out GLib.Value value,*/
GLib.ParamSpec spec, GXml.Node property_node) {
return false; // default deserialize_property gets used
}
@@ -110,9 +110,9 @@ namespace GXml {
* Interface method to handle serialization of an
* individual property. The implementing class
* receives a description of it, and should create a
- * { link GXml.DomNode} that encapsulates the property.
- * { link GXml.Serialization} will embed the { link GXml.DomNode} into
- * a "Property" { link GXml.Element}, so the { link GXml.DomNode}
+ * { link GXml.Node} that encapsulates the property.
+ * { link GXml.Serialization} will embed the { link GXml.Node} into
+ * a "Property" { link GXml.Element}, so the { link GXml.Node}
* returned can often be something as simple as
* { link GXml.Text}.
*
@@ -123,13 +123,13 @@ namespace GXml {
*
* @param property_name string name of a property to serialize.
* @param spec the { link GLib.ParamSpec} describing the property.
- * @param doc the { link GXml.Document} the returned { link GXml.DomNode} should belong to
- * @return a new { link GXml.DomNode}, or `null`
+ * @param doc the { link GXml.Document} the returned { link GXml.Node} should belong to
+ * @return a new { link GXml.Node}, or `null`
*/
/*
* @todo: consider not giving property_name, let them get name from spec?
*/
- public virtual GXml.DomNode? serialize_property (string property_name, /*GLib.Value value, */
GLib.ParamSpec spec, GXml.Document doc) {
+ public virtual GXml.Node? serialize_property (string property_name, /*GLib.Value value, */
GLib.ParamSpec spec, GXml.Document doc) {
return null; // default serialize_property gets used
}
diff --git a/gxml/Serialization.vala b/gxml/Serialization.vala
index 1545a66..0fdb062 100644
--- a/gxml/Serialization.vala
+++ b/gxml/Serialization.vala
@@ -63,7 +63,7 @@ namespace GXml {
/**
* Serializes and deserializes { link GLib.Object}s to and from
- * { link GXml.DomNode}.
+ * { link GXml.Node}.
*
* Serialization can automatically serialize a variety of public
* properties. { link GLib.Object}s can also implement the
@@ -87,10 +87,10 @@ namespace GXml {
* { link GLib.Value} can transform into a string, and
* operates recursively.
*/
- private static GXml.DomNode serialize_property (GLib.Object object, ParamSpec prop_spec,
GXml.Document doc) throws SerializationError {
+ private static GXml.Node serialize_property (GLib.Object object, ParamSpec prop_spec,
GXml.Document doc) throws SerializationError {
Type type;
Value value;
- DomNode value_node;
+ Node value_node;
Serializable serializable = null;
if (object.get_type ().is_a (typeof (Serializable))) {
@@ -181,10 +181,10 @@ namespace GXml {
}
/**
- * Serializes a { link GLib.Object} into a { link GXml.DomNode}.
+ * Serializes a { link GLib.Object} into a { link GXml.Node}.
*
* This takes a { link GLib.Object} and serializes it into a
- * { link GXml.DomNode} which can be saved to disk or
+ * { link GXml.Node} which can be saved to disk or
* transferred over a network. It handles serialization of
* primitive properties and some more complex ones like enums,
* other { link GLib.Object}s recursively, and some collections.
@@ -192,7 +192,7 @@ namespace GXml {
* The serialization process can be customised for an object
* by having the object implement the { link GXml.Serializable}
* interface, which allows direct control over the
- * conversation of individual properties into { link GXml.DomNode}s
+ * conversation of individual properties into { link GXml.Node}s
* and the object's list of properties as used by
* { link GXml.Serialization}.
*
@@ -201,15 +201,15 @@ namespace GXml {
* unsupported, or the property isn't known to the object).
*
* @param object A { link GLib.Object} to serialize
- * @return a { link GXml.DomNode} representing the serialized `object`
+ * @return a { link GXml.Node} representing the serialized `object`
*/
- public static GXml.DomNode serialize_object (GLib.Object object) throws SerializationError {
+ public static GXml.Node serialize_object (GLib.Object object) throws SerializationError {
Document doc;
Element root;
ParamSpec[] prop_specs;
Element prop;
Serializable serializable = null;
- DomNode value_prop = null;
+ Node value_prop = null;
string oid;
// If the object has been serialized before, let's not do it again!
@@ -324,7 +324,7 @@ namespace GXml {
}
// } else if (type.is_a (typeof (Gee.Collection))) {
} else if (type.is_a (typeof (GLib.Object))) {
- GXml.DomNode prop_elem_child;
+ GXml.Node prop_elem_child;
Object property_object;
prop_elem_child = prop_elem.first_child;
@@ -354,7 +354,7 @@ namespace GXml {
* some differing objects might have the same OID :( Need to
* find make it more unique than just the memory address. */
private static HashTable<string,Object> deserialize_cache = null;
- private static HashTable<string,GXml.DomNode> serialize_cache = null;
+ private static HashTable<string,GXml.Node> serialize_cache = null;
// public so that tests can call it
public static void clear_caches () {
if (Serialization.deserialize_cache != null)
@@ -368,24 +368,24 @@ namespace GXml {
Serialization.deserialize_cache = new HashTable<string,Object> (str_hash,
str_equal);
}
if (Serialization.serialize_cache == null) {
- Serialization.serialize_cache = new HashTable<string,GXml.DomNode> (str_hash,
str_equal);
+ Serialization.serialize_cache = new HashTable<string,GXml.Node> (str_hash,
str_equal);
}
}
/**
- * Deserialize a { link GXml.DomNode} back into a { link GLib.Object}.
+ * Deserialize a { link GXml.Node} back into a { link GLib.Object}.
*
- * This deserializes a { link GXml.DomNode} back into a { link GLib.Object}. The
- * { link GXml.DomNode} must represented a { link GLib.Object} as serialized by
+ * This deserializes a { link GXml.Node} back into a { link GLib.Object}. The
+ * { link GXml.Node} must represented a { link GLib.Object} as serialized by
* { link GXml.Serialization}. The types of the objects that are
* being deserialized must be known to the system
* deserializing them or a { link GXml.SerializationError} will
* result.
*
- * @param node { link GXml.DomNode} representing a { link GLib.Object}
+ * @param node { link GXml.Node} representing a { link GLib.Object}
* @return the deserialized { link GLib.Object}
*/
- public static GLib.Object deserialize_object (DomNode node) throws SerializationError {
+ public static GLib.Object deserialize_object (Node node) throws SerializationError {
Element obj_elem;
string otype;
@@ -433,7 +433,7 @@ namespace GXml {
SerializationError err = null;
- foreach (DomNode child_node in obj_elem.child_nodes) {
+ foreach (Node child_node in obj_elem.child_nodes) {
if (child_node.node_name == "Property") {
Element prop_elem;
string pname;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]