[gxml] Renamed old GXml.Element to new GXml.xElement
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Renamed old GXml.Element to new GXml.xElement
- Date: Tue, 14 Apr 2015 19:07:49 +0000 (UTC)
commit b6e8c4e682397ac64cdcab7ea87a3f39edef1bdc
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Apr 14 14:05:39 2015 -0500
Renamed old GXml.Element to new GXml.xElement
* This is the last step to avoid conflicts with new
interfaces API.
* Next step should be adding interfaces to GXml API
gxml/Serializable.vala | 14 ++++----
gxml/SerializableGeeArrayList.vala | 12 +++---
gxml/SerializableGeeDualKeyMap.vala | 12 +++---
gxml/SerializableGeeHashMap.vala | 12 +++---
gxml/SerializableGeeTreeMap.vala | 12 +++---
gxml/SerializableJson.vala | 26 ++++++++--------
gxml/SerializableObjectModel.vala | 24 +++++++-------
gxml/Serialization.vala | 14 ++++----
gxml/libxml-Document.vala | 36 +++++++++++-----------
gxml/libxml-Element.vala | 48 ++++++++++++++--------------
gxml/libxml-NamedNodeMap.vala | 6 ++--
test/AttrTest.vala | 12 +++---
test/DocumentTest.vala | 24 +++++++-------
test/ElementTest.vala | 50 +++++++++++++++---------------
test/EnumerationTest.vala | 2 +-
test/GXmlTest.vala | 6 ++--
test/SerializableGeeArrayListTest.vala | 4 +-
test/SerializableGeeCollectionsTest.vala | 14 ++++----
test/SerializableGeeDualKeyMapTest.vala | 6 ++--
test/SerializableGeeHashMapTest.vala | 8 ++--
test/SerializableGeeTreeMapTest.vala | 8 ++--
test/SerializableObjectModelTest.vala | 48 ++++++++++++++--------------
test/SerializableTest.vala | 4 +-
23 files changed, 201 insertions(+), 201 deletions(-)
---
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index 6236eb4..87d27ec 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -82,7 +82,7 @@ namespace GXml {
public abstract HashTable<string,GXml.xNode> unknown_serializable_property { get; protected set; }
/**
- * Used to add content in an { link GXml.Element}.
+ * Used to add content in an { link GXml.xElement}.
*
* By default no contents is serialized/deseralized. Implementors must implement
* { link Serializable.serialize_use_xml_node_value} function returning
@@ -97,13 +97,13 @@ namespace GXml {
public abstract string? serialized_xml_node_value { get; protected set; default = null; }
/**
- * Used to set specific namespace for an { link GXml.Element}.
+ * Used to set specific namespace for an { link GXml.xElement}.
*
- * By default no namspace prefix is added to { link GXml.Element} on serialized. Implementors
+ * By default no namspace prefix is added to { link GXml.xElement} on serialized. Implementors
* must consider { link Serializable.serialize_set_namespace} proterty value
* to discover if this node should have a namespace.
*
- * { link GXml.Element} namespace should be added before to serialize any
+ * { link GXml.xElement} namespace should be added before to serialize any
* property.
*
* This property should have a format "prefix|url".
@@ -112,7 +112,7 @@ namespace GXml {
*/
public abstract string? serialize_set_namespace { get; set; default = null; }
/**
- * Used to check { link GXml.Element}'s contents must be deseralized.
+ * Used to check { link GXml.xElement}'s contents must be deseralized.
*
* By default GXml's implementations doesn't deseriaze/serialize XML node contents.
* In order to enable it, you must override { link serialize_use_xml_node_value}
@@ -155,12 +155,12 @@ namespace GXml {
public abstract GXml.xNode? serialize (GXml.xNode node) throws GLib.Error;
/**
- * Serialize a property @prop on a { link GXml.Element}.
+ * Serialize a property @prop on a { link GXml.xElement}.
*
* This method is called recursivally by { link serialize} method over all properties
* to be serialized.
*/
- public abstract GXml.xNode? serialize_property (GXml.Element element,
+ public abstract GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error;
diff --git a/gxml/SerializableGeeArrayList.vala b/gxml/SerializableGeeArrayList.vala
index b05d089..a6a51bb 100644
--- a/gxml/SerializableGeeArrayList.vala
+++ b/gxml/SerializableGeeArrayList.vala
@@ -83,13 +83,13 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
public virtual GXml.xNode? serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
return default_serialize (node);
}
public GXml.xNode? default_serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
if (element_type.is_a (typeof (Serializable))) {
for (int i =0; i < size; i++) {
@@ -99,13 +99,13 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
}
return node;
}
- public virtual GXml.xNode? serialize_property (GXml.Element element,
+ public virtual GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
return default_serialize_property (element, prop);
}
- public GXml.xNode? default_serialize_property (GXml.Element element,
+ public GXml.xNode? default_serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
@@ -124,9 +124,9 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
throw new SerializableError.UNSUPPORTED_TYPE_ERROR ("%s: Value type '%s' is unsupported",
this.get_type ().name (), element_type.name ());
}
- if (node is Element) {
+ if (node is xElement) {
foreach (GXml.xNode n in node.child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
var obj = (Serializable) Object.new (element_type);
if (n.node_name == ((Serializable) obj).node_name ()) {
obj.deserialize (n);
diff --git a/gxml/SerializableGeeDualKeyMap.vala b/gxml/SerializableGeeDualKeyMap.vala
index 99142a9..ce5dede 100644
--- a/gxml/SerializableGeeDualKeyMap.vala
+++ b/gxml/SerializableGeeDualKeyMap.vala
@@ -164,13 +164,13 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
public virtual GXml.xNode? serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
return default_serialize (node);
}
public GXml.xNode? default_serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
foreach (V v in values ()) {
if (v is Serializable)
@@ -178,13 +178,13 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
}
return node;
}
- public virtual GXml.xNode? serialize_property (GXml.Element element,
+ public virtual GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
return default_serialize_property (element, prop);
}
- public GXml.xNode? default_serialize_property (GXml.Element element,
+ public GXml.xNode? default_serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
@@ -198,7 +198,7 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
}
public GXml.xNode? default_deserialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
if (!(value_type.is_a (typeof (GXml.Serializable)) &&
value_type.is_a (typeof (SerializableMapDualKey)))) {
@@ -206,7 +206,7 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
this.get_type ().name (), value_type.name ());
}
foreach (GXml.xNode n in node.child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
var obj = (SerializableMapDualKey<P,S>) Object.new (value_type);
if (n.node_name == ((Serializable) obj).node_name ()) {
((Serializable) obj).deserialize (n);
diff --git a/gxml/SerializableGeeHashMap.vala b/gxml/SerializableGeeHashMap.vala
index c060bdb..7b2ebef 100644
--- a/gxml/SerializableGeeHashMap.vala
+++ b/gxml/SerializableGeeHashMap.vala
@@ -80,13 +80,13 @@ public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, Ser
public virtual GXml.xNode? serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
return default_serialize (node);
}
public GXml.xNode? default_serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
if (value_type.is_a (typeof (Serializable))) {
foreach (V v in values) {
@@ -95,13 +95,13 @@ public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, Ser
}
return node;
}
- public virtual GXml.xNode? serialize_property (GXml.Element element,
+ public virtual GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
return default_serialize_property (element, prop);
}
- public GXml.xNode? default_serialize_property (GXml.Element element,
+ public GXml.xNode? default_serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
@@ -121,9 +121,9 @@ public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, Ser
throw new SerializableError.UNSUPPORTED_TYPE_ERROR ("%s: Value type '%s' is unsupported",
this.get_type ().name (), value_type.name ());
}
- if (node is Element) {
+ if (node is xElement) {
foreach (GXml.xNode n in node.child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
#if DEBUG
stdout.printf (@"Node $(node.node_name) for type '$(get_type ().name ())'\n");
#endif
diff --git a/gxml/SerializableGeeTreeMap.vala b/gxml/SerializableGeeTreeMap.vala
index b99394e..6008d02 100644
--- a/gxml/SerializableGeeTreeMap.vala
+++ b/gxml/SerializableGeeTreeMap.vala
@@ -83,13 +83,13 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, Ser
public virtual GXml.xNode? serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
return default_serialize (node);
}
public GXml.xNode? default_serialize (GXml.xNode node)
throws GLib.Error
- requires (node is Element)
+ requires (node is xElement)
{
if (value_type.is_a (typeof (Serializable))) {
foreach (V v in values) {
@@ -98,13 +98,13 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, Ser
}
return node;
}
- public virtual GXml.xNode? serialize_property (GXml.Element element,
+ public virtual GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
return default_serialize_property (element, prop);
}
- public GXml.xNode? default_serialize_property (GXml.Element element,
+ public GXml.xNode? default_serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
@@ -124,9 +124,9 @@ public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, Ser
throw new SerializableError.UNSUPPORTED_TYPE_ERROR ("%s: Value type '%s' is unsupported",
this.get_type ().name (), value_type.name ());
}
- if (node is Element) {
+ if (node is xElement) {
foreach (GXml.xNode n in node.child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
#if DEBUG
stdout.printf (@"Node $(node.node_name) for type '$(get_type ().name ())'\n");
#endif
diff --git a/gxml/SerializableJson.vala b/gxml/SerializableJson.vala
index 802ccab..a2b64f7 100644
--- a/gxml/SerializableJson.vala
+++ b/gxml/SerializableJson.vala
@@ -50,13 +50,13 @@
/**
- * An implementation of { link Serializable} using an { link Element} called "Object".
+ * An implementation of { link Serializable} using an { link xElement} called "Object".
*
- * { link Element} have two properties with object type and object id.
+ * { link xElement} have two properties with object type and object id.
*
- * It uses a set children { link Element} for each Object property with two { link Attr},
+ * It uses a set children { link xElement} for each Object property with two { link Attr},
* one for its type and one for its name; property's value is set as the property
- * { link Element}'s content text.
+ * { link xElement}'s content text.
*/
public class GXml.SerializableJson : GLib.Object, GXml.Serializable
{
@@ -111,15 +111,15 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
/**
* If @node is a xDocument serialize just add an <Object> element.
*
- * If @node is an Element serialize add to it an <Object> element.
+ * If @node is an xElement serialize add to it an <Object> element.
*
- * Is up to you to add convenient Element node to a xDocument, in order to be
+ * Is up to you to add convenient xElement node to a xDocument, in order to be
* used by serialize and add new <Object> tags per object to serialize.
*/
public GXml.xNode? serialize (GXml.xNode node) throws GLib.Error
{
xDocument doc;
- Element root;
+ xElement root;
ParamSpec[] props;
string oid = "%p".printf(this);
@@ -139,14 +139,14 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
return root;
}
- public virtual GXml.xNode? serialize_property (Element element,
+ public virtual GXml.xNode? serialize_property (xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
Type type;
Value val;
GXml.xNode value_node = null;
- Element prop_node;
+ xElement prop_node;
type = prop.value_type;
@@ -211,14 +211,14 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
public GXml.xNode? deserialize (GXml.xNode node) throws GLib.Error
{
- Element obj_elem;
+ xElement obj_elem;
ParamSpec[] specs;
if (node is xDocument) {
obj_elem = node.owner_document.document_element;
}
else {
- obj_elem = (Element) node;
+ obj_elem = (xElement) node;
}
specs = this.list_serializable_properties ();
@@ -234,7 +234,7 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
//GLib.message ("At SerializableJson.deserialize_property");
if (property_node.node_name == "Property")
{
- Element prop_elem;
+ xElement prop_elem;
string pname;
string ptype;
Type type;
@@ -242,7 +242,7 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
ParamSpec spec;
//string ptype;
- prop_elem = (Element)property_node;
+ prop_elem = (xElement)property_node;
pname = prop_elem.get_attribute ("pname");
ptype = prop_elem.get_attribute ("ptype");
type = Type.from_name (ptype);
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index 1c4dfd0..7ebe8c5 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -21,13 +21,13 @@
*/
/**
- * Object Model is an { link Serializable} implementation using { link Element}
+ * Object Model is an { link Serializable} implementation using { link xElement}
* to represent { link GLib.Object} class objects.
*
* This implementation consider each object as a XML node, represented in GXml
- * as a { link GXml.Element} and its properties is represented by { link GXml.Attr}.
+ * as a { link GXml.xElement} and its properties is represented by { link GXml.Attr}.
* Each property, if it is a { link Serializable} object, is represented as child
- * { link Element}.
+ * { link xElement}.
*
* If a object's value property must be represented as a XML node content,
* then it requires to override { link Serializable.serialize_use_xml_node_value}
@@ -95,7 +95,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
public virtual GXml.xNode? serialize (GXml.xNode node)
throws GLib.Error
requires (node_name () != null)
- requires (node is xDocument || node is Element)
+ requires (node is xDocument || node is xElement)
{
return default_serialize (node);
}
@@ -122,7 +122,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
if (get_enable_unknown_serializable_property ()) {
foreach (xNode n in unknown_serializable_property.get_values ()) {
- if (n is Element) {
+ if (n is xElement) {
var e = (xNode) doc.create_element (n.node_name);
n.copy (ref e, true);
element.append_child (e);
@@ -153,13 +153,13 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
return element;
}
- public virtual GXml.xNode? serialize_property (GXml.Element element,
+ public virtual GXml.xNode? serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
return default_serialize_property (element, prop);
}
- public GXml.xNode? default_serialize_property (GXml.Element element,
+ public GXml.xNode? default_serialize_property (GXml.xElement element,
GLib.ParamSpec prop)
throws GLib.Error
{
@@ -232,11 +232,11 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
else
doc = node.owner_document;
- Element element;
- if (node is Element)
- element = (Element) node;
+ xElement element;
+ if (node is xElement)
+ element = (xElement) node;
else
- element = (Element) doc.document_element;
+ element = (xElement) doc.document_element;
return_val_if_fail (element != null, null);
if (node_name () == null) {
message (@"WARNING: Object type '$(get_type ().name ())' have no Node Name defined");
@@ -297,7 +297,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
}
}
}
- if (n is Element && !cnodes.has_key (n.node_name)) {
+ if (n is xElement && !cnodes.has_key (n.node_name)) {
#if DEBUG
stdout.printf (@"$(get_type ().name ()): DESERIALIZING ELEMENT '$(n.node_name)'\n");
#endif
diff --git a/gxml/Serialization.vala b/gxml/Serialization.vala
index c8e6a46..1d38dd5 100644
--- a/gxml/Serialization.vala
+++ b/gxml/Serialization.vala
@@ -216,9 +216,9 @@ namespace GXml {
public static GXml.xDocument serialize_object (GLib.Object object) throws GLib.Error
{
xDocument doc;
- Element root;
+ xElement root;
ParamSpec[] prop_specs;
- Element prop;
+ xElement prop;
GXml.xNode value_prop = null;
string oid;
@@ -292,7 +292,7 @@ namespace GXml {
* strings back to other types, we use our own function to do
* that.
*/
- private static void deserialize_property (ParamSpec spec, Element prop_elem,
+ private static void deserialize_property (ParamSpec spec, xElement prop_elem,
out Value val)
throws GLib.Error
{
@@ -376,7 +376,7 @@ namespace GXml {
internal static GLib.Object? deserialize_object_from_node (GXml.xNode obj_node)
throws GLib.Error
{
- Element obj_elem;
+ xElement obj_elem;
string otype;
string oid;
Type type;
@@ -384,7 +384,7 @@ namespace GXml {
unowned ObjectClass obj_class;
ParamSpec[] specs;
- obj_elem = (Element)obj_node;
+ obj_elem = (xElement)obj_node;
// FIXME: Remove cache.
// If the object has been deserialised before, get it from cache
@@ -418,11 +418,11 @@ namespace GXml {
foreach (GXml.xNode child_node in obj_elem.child_nodes) {
if (child_node.node_name == "Property") {
- Element prop_elem;
+ xElement prop_elem;
string pname;
Value val;
- prop_elem = (Element)child_node;
+ prop_elem = (xElement)child_node;
pname = prop_elem.get_attribute ("pname");
// Check name and type for property
ParamSpec? spec = null;
diff --git a/gxml/libxml-Document.vala b/gxml/libxml-Document.vala
index 03aa61b..5c1b20c 100644
--- a/gxml/libxml-Document.vala
+++ b/gxml/libxml-Document.vala
@@ -49,7 +49,7 @@ namespace GXml {
/**
* Represents an XML xDocument as a tree of { link GXml.xNode}s.
*
- * The xDocument has a root document element { link GXml.Element}.
+ * The xDocument has a root document element { link GXml.xElement}.
* A xDocument's schema can be defined through its
* { link GXml.DocumentType}.
*
@@ -80,7 +80,7 @@ namespace GXml {
* Perhaps I really should implement a NamedNodeMap :|
* TODO: do that
*/
- internal List<Element> dirty_elements = new List<Element> ();
+ internal List<xElement> dirty_elements = new List<xElement> ();
/* TODO: for future reference, find out if internals
are only accessible by children when they're
@@ -109,7 +109,7 @@ namespace GXml {
NodeType nodetype = (NodeType)xmlnode->type;
switch (nodetype) {
case NodeType.ELEMENT:
- new Element (xmlnode, this);
+ new xElement (xmlnode, this);
break;
case NodeType.TEXT:
new Text (xmlnode, this);
@@ -186,10 +186,10 @@ namespace GXml {
* Version: DOM Level 1 Core<<BR>>
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#attribute-documentElement]]
*/
- public Element document_element {
+ public xElement document_element {
// TODO: should children work at all on xDocument, or just this, to get root?
get {
- return (Element)this.lookup_node (this.xmldoc->get_root_element ());
+ return (xElement)this.lookup_node (this.xmldoc->get_root_element ());
}
private set {
}
@@ -589,7 +589,7 @@ namespace GXml {
/* Public Methods */
/**
- * Creates an empty { link GXml.Element} node with the tag name
+ * Creates an empty { link GXml.xElement} node with the tag name
* `tag_name`, which must be a
* [[http://www.w3.org/TR/REC-xml/#NT-Name|valid XML name]].
* Its memory is freed when its owner document is
@@ -600,11 +600,11 @@ namespace GXml {
* Version: DOM Level 1 Core<<BR>>
* URL: [[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-createElement]]
- * @param tag_name The name of the new { link GXml.Element}
+ * @param tag_name The name of the new { link GXml.xElement}
*
- * @return A new { link GXml.Element}; this should not be freed
+ * @return A new { link GXml.xElement}; this should not be freed
*/
- public unowned Element create_element (string tag_name) {
+ public unowned xElement create_element (string tag_name) {
// TODO: what should we be passing for ns other than old_ns? Figure it out; needed
for level 2+ support
Xml.Node *xmlelem;
@@ -613,9 +613,9 @@ namespace GXml {
xmlelem = this.xmldoc->new_node (null, tag_name, null);
this.new_nodes.append (xmlelem);
- Element new_elem = new Element (xmlelem, this);
+ xElement new_elem = new xElement (xmlelem, this);
this.nodes_to_free.append (new_elem);
- unowned Element ret = new_elem;
+ unowned xElement ret = new_elem;
return ret;
}
@@ -754,7 +754,7 @@ namespace GXml {
}
/**
- * Creates an { link GXml.Attr} attribute with `name`, usually to be associated with an
Element.
+ * Creates an { link GXml.Attr} attribute with `name`, usually to be associated with an
xElement.
*
* XML example: {{{<element attributename="attributevalue">content</element>}}}
*
@@ -818,7 +818,7 @@ namespace GXml {
}
/**
- * Obtains a list of { link GXml.Element}s, each with
+ * Obtains a list of { link GXml.xElement}s, each with
* the given tag name `tag_name`, contained within
* this document.
*
@@ -833,10 +833,10 @@ namespace GXml {
* Version: DOM Level 1 Core<<BR>>
* URL:
[[http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-getElementsByTagName]]
*
- * @param tag_name The { link GXml.Element} tag name we matching for
+ * @param tag_name The { link GXml.xElement} tag name we matching for
*
* @return A { link GXml.NodeList} of
- * { link GXml.Element}s; this must be freed with
+ * { link GXml.xElement}s; this must be freed with
* { link GLib.Object.unref}.
*/
public NodeList get_elements_by_tag_name (string tag_name) {
@@ -937,7 +937,7 @@ namespace GXml {
* Inserts `new_child` into this document before
* `ref_child`, an existing child of this
* { link GXml.xDocument}. A document can only have one
- * { link GXml.Element} child (the root element) and
+ * { link GXml.xElement} child (the root element) and
* one { link GXml.DocumentType}.
*
* Version: DOM Level 1 Core<<BR>>
@@ -962,7 +962,7 @@ namespace GXml {
/**
* Appends new_child to this document, appearing at
* the end of its list of children. A document can
- * only have one { link GXml.Element} child, the root
+ * only have one { link GXml.xElement} child, the root
* element, and one { link GXml.DocumentType}.
*
* Version: DOM Level 1 Core<<BR>>
@@ -978,7 +978,7 @@ namespace GXml {
if (new_child.node_type == NodeType.ELEMENT) {
if (xmldoc->get_root_element () == null) {
- xmldoc->set_root_element (((Element)new_child).node);
+ xmldoc->set_root_element (((xElement)new_child).node);
} else {
GXml.warning (DomException.HIERARCHY_REQUEST, "Document already has a
root element. Could not add child element with name '%s'".printf (new_child.node_name));
}
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index 46f016e..e205dfa 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -1,5 +1,5 @@
/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
-/* Element.vala
+/* libxml-Element.vala
*
* Copyright (C) 2011-2013 Richard Schwarting <aquarichy gmail com>
* Copyright (C) 2011,2015 Daniel Espinosa <esodan gmail com>
@@ -26,7 +26,7 @@ namespace GXml {
// TODO: figure out how to create this; Xml.Doc doesn't have new_element()
/**
- * Represent an XML Element node, which have attributes and children.
+ * Represent an XML xElement node, which have attributes and children.
*
* To create one, use { link GXml.xDocument.create_element}.
*
@@ -41,7 +41,7 @@ namespace GXml {
* Version: DOM Level 1 Core<<BR>>
* URL: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-745549614]]
*/
- public class Element : BackedNode {
+ public class xElement : BackedNode {
/* Public properties */
// TODO: find out how to do double-spaces in Valadoc, so we can indent <img...
@@ -87,7 +87,7 @@ namespace GXml {
/**
* Contains a { link GXml.NamedAttrMap} of
* { link GXml.Attr} attributes associated with this
- * { link GXml.Element}.
+ * { link GXml.xElement}.
*
* Attributes in the NamedNodeMap are updated live, so
* changes in the element's attributes through its
@@ -110,7 +110,7 @@ namespace GXml {
}
/* Constructors */
- internal Element (Xml.Node *node, xDocument doc) {
+ internal xElement (Xml.Node *node, xDocument doc) {
base (node, doc);
// TODO: consider string ownership, libxml2 memory
}
@@ -217,12 +217,12 @@ namespace GXml {
}
// TODO: consider making the life of TagNameNodeLists optional, and dead by default, at the
xDocument level
- private void check_add_tag_name (Element basenode, xNode child) {
+ private void check_add_tag_name (xElement basenode, xNode 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
if (child.node_type == NodeType.ELEMENT) {
- basenode.on_new_descendant_with_tag_name ((Element)child);
+ basenode.on_new_descendant_with_tag_name ((xElement)child);
}
// 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
@@ -232,15 +232,15 @@ namespace GXml {
}
}
/**
- * Checks whether a descendant of a node is an Element, or whether its descendants
+ * Checks whether a descendant of a node is an xElement, or whether its descendants
* 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, xNode child) {
+ private void check_remove_tag_name (xElement basenode, xNode 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);
+ basenode.on_remove_descendant_with_tag_name ((xElement)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 (xNode grand_child in child.child_nodes) {
@@ -322,7 +322,7 @@ namespace GXml {
/* Adds a new descendant to this elements cached list of child descendants,
used to isolate the subtree of nodes when filtering by tag name */
- private void on_new_descendant_with_tag_name (Element elem) {
+ private void on_new_descendant_with_tag_name (xElement elem) {
// TODO: consider using a HashTable instead
foreach (TagNameNodeList list in tag_name_lists) {
// TODO: take into account case sensitivity or insensitivity?
@@ -332,18 +332,18 @@ namespace GXml {
}
}
if (this.parent_node != null && this.parent_node.node_type == NodeType.ELEMENT)
- ((Element)this.parent_node).on_new_descendant_with_tag_name (elem);
+ ((xElement)this.parent_node).on_new_descendant_with_tag_name (elem);
}
/**
* Checks whether this element has a TagNameNodeList containing this element,
* and if so, removes it. It also asks the parents above if they have such
* a list.
*/
- private void on_remove_descendant_with_tag_name (Element elem) {
+ private void on_remove_descendant_with_tag_name (xElement elem) {
foreach (TagNameNodeList list in tag_name_lists) {
if (elem.tag_name == list.tag_name) {
foreach (xNode tag_elem in list) {
- if (((Element)tag_elem) == elem) {
+ if (((xElement)tag_elem) == elem) {
list.remove_child (tag_elem);
break;
}
@@ -352,12 +352,12 @@ namespace GXml {
}
}
if (this.parent_node != null && this.parent_node.node_type == NodeType.ELEMENT)
- ((Element)this.parent_node).on_remove_descendant_with_tag_name (elem);
+ ((xElement)this.parent_node).on_remove_descendant_with_tag_name (elem);
}
/**
* Obtains a NodeList of Elements with the given
- * tag_name that are descendants of this Element.
+ * tag_name that are descendants of this xElement.
* This will include the current element if it
* matches. The returned list is updated as necessary
* as the tree changes.
@@ -416,7 +416,7 @@ namespace GXml {
foreach (xNode child in this.child_nodes) {
switch (child.node_type) {
case NodeType.ELEMENT:
- ((Element)child).normalize ();
+ ((xElement)child).normalize ();
break;
case NodeType.TEXT:
// TODO: check siblings: what happens in vala when you modify a list
you're iterating?
@@ -442,7 +442,7 @@ namespace GXml {
* {{{Eeylops Owl EmporiumObscurus Books}}} with the
* XML tags omitted.
*
- * Setting content replaces the Element's children
+ * Setting content replaces the xElement's children
* with a Text node containing `value`.
*/
// TODO: add test
@@ -462,24 +462,24 @@ namespace GXml {
/**
* { inheritDoc}
*
- * For { link GXml.Element} this method copy attributes and child nodes
+ * For { link GXml.xElement} this method copy attributes and child nodes
* when @deep is set to true.
*
* @param node: could be owned by other { link GXml.xDocument}.
* @param deep: copy child nodes if true.
*/
public override bool copy (ref xNode node, bool deep = false)
- requires (node is Element)
+ requires (node is xElement)
{
node.node_name = this.node_name;
- ((Element) node).content = null;
- ((Element) node).content = this.content;
+ ((xElement) node).content = null;
+ ((xElement) node).content = this.content;
foreach (Attr attr in attributes.get_values ()) {
- ((Element) node).set_attribute (attr.node_name, attr.node_value);
+ ((xElement) node).set_attribute (attr.node_name, attr.node_value);
}
if (has_child_nodes () && deep) {
foreach (xNode n in child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
var element = (xNode) node.owner_document.create_element
(n.node_name);
n.copy (ref element, true);
node.append_child ( element);
diff --git a/gxml/libxml-NamedNodeMap.vala b/gxml/libxml-NamedNodeMap.vala
index 09d75b0..32c8f51 100644
--- a/gxml/libxml-NamedNodeMap.vala
+++ b/gxml/libxml-NamedNodeMap.vala
@@ -45,12 +45,12 @@ namespace GXml {
/**
* A class implementing { link NamedNodeMap} interface for { link Attr} objects.
*
- * A collection of { link NamedNodeMap} of type { link Attr} objects in a { link Element}.
+ * A collection of { link NamedNodeMap} of type { link Attr} objects in a { link xElement}.
*/
public class NamedAttrMap : GLib.Object, NamedNodeMap<Attr?> {
- private Element elem;
+ private xElement elem;
- internal NamedAttrMap (Element e) {
+ internal NamedAttrMap (xElement e) {
this.elem = e;
}
diff --git a/test/AttrTest.vala b/test/AttrTest.vala
index 20cfd19..47836c0 100644
--- a/test/AttrTest.vala
+++ b/test/AttrTest.vala
@@ -30,7 +30,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/namespace_uri", () => {
xDocument doc = new xDocument.from_string ("<Wands
xmlns:wands=\"http://mom.co.uk/wands\";><Wand price=\"43.56\" wands:core=\"dragon heart cord\"
wands:shell=\"oak\"/></Wands>");
GXml.xNode root = doc.document_element;
- Element node = (Element)root.child_nodes.item (0);
+ xElement node = (xElement)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core");
Attr shell = node.get_attribute_node ("shell");
@@ -43,7 +43,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/prefix", () => {
xDocument doc = new xDocument.from_string ("<Wands
xmlns:wands=\"http://mom.co.uk/wands\";><Wand price=\"43.56\" wands:core=\"dragon heart cord\"
wands:shell=\"oak\"/></Wands>");
GXml.xNode root = doc.document_element;
- Element node = (Element)root.child_nodes.item (0);
+ xElement node = (xElement)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core");
Attr shell = node.get_attribute_node ("shell");
@@ -56,7 +56,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/local_name", () => {
xDocument doc = new xDocument.from_string ("<Wands
xmlns:wands=\"http://mom.co.uk/wands\";><Wand price=\"43.56\" wands:core=\"dragon heart cord\"
wands:shell=\"oak\"/></Wands>");
GXml.xNode root = doc.document_element;
- Element node = (Element)root.child_nodes.item (0);
+ xElement node = (xElement)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core");
Attr shell = node.get_attribute_node ("shell");
@@ -110,7 +110,7 @@ class AttrTest : GXmlTest {
});
Test.add_func ("/gxml/attribute/parent_node", () => {
xDocument doc = get_doc ();
- Element elem = get_elem ("creature", doc);
+ xElement elem = get_elem ("creature", doc);
Attr attr = get_attr ("breed", "Dragons", doc);
assert (attr.parent_node == null);
@@ -119,7 +119,7 @@ class AttrTest : GXmlTest {
});
Test.add_func ("/gxml/attribute/previous_sibling", () => {
xDocument doc = get_doc ();
- Element elem = get_elem ("creature", doc);
+ xElement elem = get_elem ("creature", doc);
Attr attr1 = get_attr ("breed", "Dragons", doc);
Attr attr2 = get_attr ("size", "large", doc);
@@ -131,7 +131,7 @@ class AttrTest : GXmlTest {
});
Test.add_func ("/gxml/attribute/next_sibling", () => {
xDocument doc = get_doc ();
- Element elem = get_elem ("creature", doc);
+ xElement elem = get_elem ("creature", doc);
Attr attr1 = get_attr ("breed", "Dragons", doc);
Attr attr2 = get_attr ("size", "large", doc);
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index 16b1eb5..d3c4dd6 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -51,7 +51,7 @@ class DocumentTest : GXmlTest {
});
Test.add_func ("/gxml/document/document_element", () => {
xDocument doc = get_doc ();
- Element root = doc.document_element;
+ xElement root = doc.document_element;
assert (root.node_name == "Sentences");
assert (root.has_child_nodes ());
@@ -230,7 +230,7 @@ class DocumentTest : GXmlTest {
});
Test.add_func ("/gxml/document/create_element", () => {
xDocument doc = get_doc ();
- Element elem = null;
+ xElement elem = null;
elem = doc.create_element ("Banana");
test_error (DomException.NONE);
@@ -246,18 +246,18 @@ class DocumentTest : GXmlTest {
DocumentFragment fragment = doc.create_document_fragment ();
// TODO: can we set XML in the content, and actually have that translate into
real libxml2 underlying nodes?
- Element percy = doc.create_element ("Author");
- Element percy_name = doc.create_element ("Name");
- Element percy_email = doc.create_element ("Email");
+ xElement percy = doc.create_element ("Author");
+ xElement percy_name = doc.create_element ("Name");
+ xElement percy_email = doc.create_element ("Email");
percy_name.content = "Percy";
percy_email.content = "pweasley hogwarts co uk";
percy.append_child (percy_name);
percy.append_child (percy_email);
fragment.append_child (percy);
- Element ginny = doc.create_element ("Author");
- Element ginny_name = doc.create_element ("Name");
- Element ginny_email = doc.create_element ("Email");
+ xElement ginny = doc.create_element ("Author");
+ xElement ginny_name = doc.create_element ("Name");
+ xElement ginny_email = doc.create_element ("Email");
ginny_name.content = "Ginny";
ginny_email.content = "weasleyg hogwarts co uk";
ginny.append_child (ginny_name);
@@ -266,7 +266,7 @@ class DocumentTest : GXmlTest {
NodeList authors_list = doc.get_elements_by_tag_name ("Authors");
assert (authors_list.length == 1);
- Element authors = (Element)authors_list.item (0);
+ xElement authors = (xElement)authors_list.item (0);
assert (authors.get_elements_by_tag_name ("Author").length == 2);
assert (fragment.child_nodes.length == 2);
@@ -362,8 +362,8 @@ class DocumentTest : GXmlTest {
NodeList elems = doc.get_elements_by_tag_name ("Email");
assert (elems.length == 2);
- assert (((Element)elems.item (0)).content == "fweasley hogwarts co uk");
- /* more thorough test exists in Element, since right now
+ assert (((xElement)elems.item (0)).content == "fweasley hogwarts co uk");
+ /* more thorough test exists in xElement, since right now
xDocument uses that one */
});
Test.add_func ("/gxml/document/to_string", () => {
@@ -390,7 +390,7 @@ class DocumentTest : GXmlTest {
}
private static void check_contents (xDocument test_doc) {
- Element root = test_doc.document_element;
+ xElement root = test_doc.document_element;
assert (root.node_name == "Sentences");
assert (root.has_child_nodes () == true);
diff --git a/test/ElementTest.vala b/test/ElementTest.vala
index 6925718..5c0a26b 100644
--- a/test/ElementTest.vala
+++ b/test/ElementTest.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 -*- */
/* Notation.vala
*
* Copyright (C) 2011-2013 Richard Schwarting <aquarichy gmail com>
@@ -25,10 +25,10 @@
using GXml;
// namespace GXml {
-// public class TestElement : Element {
+// public class TestElement : xElement {
// public TestElement (Xml.Node *node, xDocument doc) {
// /* /home2/richard/gxml/test/ElementTest.vala:7.4-7.19: error: chain up
-// to `GXml.Element' not supported */
+// to `GXml.xElement' not supported */
// base (node, doc);
// }
// }
@@ -37,7 +37,7 @@ using GXml;
class ElementTest : GXmlTest {
public static void add_tests () {
Test.add_func ("/gxml/element/namespace_support_manual", () => {
- // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of Element?
+ // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of xElement?
Xml.Doc *xmldoc;
Xml.Node *xmlroot;
Xml.Node *xmlnode;
@@ -67,7 +67,7 @@ class ElementTest : GXmlTest {
assert (node.node_name == "Potion");
});
Test.add_func ("/gxml/element/namespace_uri", () => {
- // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of Element?
+ // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of xElement?
xDocument doc = new xDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\";
xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
GXml.xNode root = doc.document_element;
GXml.xNode node = root.child_nodes.item (0);
@@ -75,7 +75,7 @@ class ElementTest : GXmlTest {
assert (node.namespace_uri == "http://hogwarts.co.uk/magic";);
});
Test.add_func ("/gxml/element/testing", () => {
- // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of Element?
+ // TODO: wanted to use TestElement but CAN'T because Vala won't let me access
the internal constructor of xElement?
xDocument doc = new xDocument.from_string ("<Potions><magic:Potion
xmlns:magic=\"http://hogwarts.co.uk/magic\";
xmlns:products=\"http://diagonalley.co.uk/products\";><products:Ingredient /></magic:Potion></Potions>");
GXml.xNode root = doc.document_element;
GXml.xNode node = root.child_nodes.item (0);
@@ -127,7 +127,7 @@ class ElementTest : GXmlTest {
NamedAttrMap attributes;
xDocument doc;
- Element elem;
+ xElement elem;
doc = get_doc ();
@@ -176,7 +176,7 @@ class ElementTest : GXmlTest {
});
Test.add_func ("/gxml/element/get_set_attribute", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("student", out doc);
+ xElement elem = get_elem_new_doc ("student", out doc);
assert ("" == elem.get_attribute ("name"));
@@ -187,7 +187,7 @@ class ElementTest : GXmlTest {
});
Test.add_func ("/gxml/element/remove_attribute", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("tagname", out doc);
+ xElement elem = get_elem_new_doc ("tagname", out doc);
elem.set_attribute ("name", "Malfoy");
assert ("Malfoy" == elem.get_attribute ("name"));
@@ -200,7 +200,7 @@ class ElementTest : GXmlTest {
});
Test.add_func ("/gxml/element/get_attribute_node", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("tagname", out doc);
+ xElement elem = get_elem_new_doc ("tagname", out doc);
assert (elem.get_attribute_node ("name") == null);
elem.set_attribute ("name", "Severus");
@@ -208,7 +208,7 @@ class ElementTest : GXmlTest {
});
Test.add_func ("/gxml/element/set_attribute_node", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("tagname", out doc);
+ xElement elem = get_elem_new_doc ("tagname", out doc);
Attr attr1 = elem.owner_document.create_attribute ("name");
Attr attr2 = elem.owner_document.create_attribute ("name");
@@ -227,7 +227,7 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/remove_attribute_node", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("tagname", out doc);
+ xElement elem = get_elem_new_doc ("tagname", out doc);
Attr attr;
attr = elem.owner_document.create_attribute ("name");
@@ -246,9 +246,9 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/get_elements_by_tag_name", () => {
xDocument doc;
GXml.xNode root;
- Element elem;
+ xElement elem;
NodeList emails;
- Element email;
+ xElement email;
Text text;
doc = get_doc ();
@@ -256,11 +256,11 @@ class ElementTest : GXmlTest {
root = doc.document_element; // child_nodes.nth_data (0);
assert (root.node_name == "Sentences");
- elem = (Element)root;
+ elem = (xElement)root;
emails = elem.get_elements_by_tag_name ("Email");
assert (emails.length == 2);
- email = (Element)emails get (0);
+ email = (xElement)emails get (0);
assert (email.tag_name == "Email");
assert (email.child_nodes.length == 1);
@@ -268,7 +268,7 @@ class ElementTest : GXmlTest {
assert (text.node_name == "#text");
assert (text.node_value == "fweasley hogwarts co uk");
- email = (Element)emails get (1);
+ email = (xElement)emails get (1);
assert (email.tag_name == "Email");
assert (email.child_nodes.length == 1);
@@ -318,7 +318,7 @@ class ElementTest : GXmlTest {
GXml.xNode b3 = bs.child_nodes.item (7);
GXml.xNode t1, t2;
- NodeList ts = ((Element)bs).get_elements_by_tag_name ("t");
+ NodeList ts = ((xElement)bs).get_elements_by_tag_name ("t");
assert (ts.length == 5);
// Test adding direct child
@@ -384,21 +384,21 @@ class ElementTest : GXmlTest {
});
Test.add_func ("/gxml/element/normalize", () => {
xDocument doc;
- Element elem = get_elem_new_doc ("tagname", out doc);
+ xElement elem = get_elem_new_doc ("tagname", out doc);
elem.normalize ();
// STUB
});
Test.add_func ("/gxml/element/to_string", () =>{
xDocument doc, doc2;
- Element elem = get_elem_new_doc ("country", out doc);
+ xElement elem = get_elem_new_doc ("country", out doc);
elem.append_child (elem.owner_document.create_text_node ("New Zealand"));
if (elem.to_string () != "<country>New Zealand</country>") {
- stdout.printf (@"ERROR: Element to_string() fail. Expected <country>New
Zealand</country> got: $(elem.to_string ())\n");
+ stdout.printf (@"ERROR: xElement to_string() fail. Expected <country>New
Zealand</country> got: $(elem.to_string ())\n");
assert_not_reached ();
}
// during stringification, we don't want to confuse XML <> with text <>
- Element elem2 = get_elem_new_doc ("messy", out doc2);
+ xElement elem2 = get_elem_new_doc ("messy", out doc2);
elem2.append_child (elem.owner_document.create_text_node ("<<>>"));
string expected = "<messy>&lt;<>&gt;</messy>";
if (elem2.to_string () != expected) {
@@ -418,7 +418,7 @@ class ElementTest : GXmlTest {
<root>TEXT1</root>
""";
if (doc.to_string () != d) {
- stdout.printf (@"Element content error. Expected '$d'\ngot '$(doc)'\n");
+ stdout.printf (@"xElement content error. Expected '$d'\ngot '$(doc)'\n");
assert_not_reached ();
}
});
@@ -434,7 +434,7 @@ class ElementTest : GXmlTest {
<root>TEXT1</root>
""";
if (doc.to_string () != d) {
- stdout.printf (@"Element content error. Expected '$d'\ngot '$(doc)'\n");
+ stdout.printf (@"xElement content error. Expected '$d'\ngot '$(doc)'\n");
assert_not_reached ();
}
});
@@ -451,7 +451,7 @@ class ElementTest : GXmlTest {
<root><child/>TEXT1</root>
""";
if (doc.to_string () != d) {
- stdout.printf (@"Element content error. Expected\n'$d'\ngot\n'$(doc)'\n");
+ stdout.printf (@"xElement content error. Expected\n'$d'\ngot\n'$(doc)'\n");
assert_not_reached ();
}
});
diff --git a/test/EnumerationTest.vala b/test/EnumerationTest.vala
index f9bb211..b3b3912 100644
--- a/test/EnumerationTest.vala
+++ b/test/EnumerationTest.vala
@@ -120,7 +120,7 @@ class SerializableEnumerationTest : GXmlTest
stdout.printf (@"ERROR: bad root name:\n$(doc)");
assert_not_reached ();
}
- Element element = doc.document_element;
+ xElement element = doc.document_element;
var op = element.get_attribute_node ("options");
if (op == null) {
stdout.printf (@"ERROR: attribute options not found:\n$(doc)");
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index 13045c4..dbf14db 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -109,12 +109,12 @@ class GXmlTest {
return attr;
}
- internal static Element get_elem_new_doc (string name, out xDocument doc) {
+ internal static xElement get_elem_new_doc (string name, out xDocument doc) {
return get_elem (name, doc = get_doc ());
}
- internal static Element get_elem (string name, xDocument doc) {
- Element elem = doc.create_element (name);
+ internal static xElement get_elem (string name, xDocument doc) {
+ xElement elem = doc.create_element (name);
return elem;
}
diff --git a/test/SerializableGeeArrayListTest.vala b/test/SerializableGeeArrayListTest.vala
index 3d7617d..8e76f6e 100644
--- a/test/SerializableGeeArrayListTest.vala
+++ b/test/SerializableGeeArrayListTest.vala
@@ -83,8 +83,8 @@ class SerializableGeeArrayListTest : GXmlTest
bool found1 = false;
bool found2 = false;
foreach (GXml.xNode n in root.child_nodes) {
- if (n is Element && n.node_name == "aelement") {
- var name = ((Element) n).get_attribute_node ("name");
+ if (n is xElement && n.node_name == "aelement") {
+ var name = ((xElement) n).get_attribute_node ("name");
if (name != null) {
if (name.node_value == "Big") found1 = true;
if (name.node_value == "Small") found2 = true;
diff --git a/test/SerializableGeeCollectionsTest.vala b/test/SerializableGeeCollectionsTest.vala
index 2ea55b9..ad1d0ae 100644
--- a/test/SerializableGeeCollectionsTest.vala
+++ b/test/SerializableGeeCollectionsTest.vala
@@ -33,7 +33,7 @@ class SerializableGeeCollectionsTest : GXmlTest
public string ctype { get; set; }
public string get_value () { return serialized_xml_node_value; }
public void set_value (string val) { serialized_xml_node_value = val; }
- //Enable set Element content
+ //Enable set xElement content
public override bool serialize_use_xml_node_value () { return true; }
public override string to_string () { return @"Citizen: $ctype"; }
public override string node_name () { return "citizen"; }
@@ -508,7 +508,7 @@ class SerializableGeeCollectionsTest : GXmlTest
}
//stdout.printf (@"$doc\n");
foreach (GXml.xNode n in doc.document_element.child_nodes) {
- if (n is Element) {
+ if (n is xElement) {
if (n.node_name == "ChargeZone") {
}
@@ -517,19 +517,19 @@ class SerializableGeeCollectionsTest : GXmlTest
bool tfound = false;
bool attrfound = false;
foreach (GXml.xNode sn in n.child_nodes) {
- if (sn is Element) {
+ if (sn is xElement) {
if (sn.node_name == "refaction") {
foreach (GXml.xNode rn in sn.child_nodes) {
- if (rn is Element) {
+ if (rn is xElement) {
//stdout.printf (@"Refaction current node: '$(rn.node_name)'\n");
if (rn.node_name == "ship") {
- var atr = ((Element) rn).get_attribute_node ("manufacturer");
+ var atr = ((xElement) rn).get_attribute_node ("manufacturer");
if (atr == null) {
stdout.printf (@"ERROR: No attribute manufacturer for Ship\n");
assert_not_reached ();
}
if (atr.node_value == "MegaTrench") {
- var shanattr = ((Element) rn).get_attribute_node ("unknown");
+ var shanattr = ((xElement) rn).get_attribute_node ("unknown");
if (shanattr != null) {
attrfound = true;
if (shanattr.node_value != "UNKNOWN ATTR") {
@@ -551,7 +551,7 @@ class SerializableGeeCollectionsTest : GXmlTest
}
if (rn.node_name == "UnknownAttribute") {
unkfound = true;
- var nattr = ((Element) rn).get_attribute_node ("name");
+ var nattr = ((xElement) rn).get_attribute_node ("name");
if (nattr == null) {
stdout.printf (@"ERROR: No Unknown Attribute Node with attribute name\n");
assert_not_reached ();
diff --git a/test/SerializableGeeDualKeyMapTest.vala b/test/SerializableGeeDualKeyMapTest.vala
index dcb7a0d..ac963f9 100644
--- a/test/SerializableGeeDualKeyMapTest.vala
+++ b/test/SerializableGeeDualKeyMapTest.vala
@@ -158,10 +158,10 @@ class SerializableGeeDualKeyMapTest : GXmlTest
int i = 0;
foreach (GXml.xNode n in root.child_nodes) {
nodes++;
- if (n is Element && n.node_name == "spaces") {
+ if (n is xElement && n.node_name == "spaces") {
i++;
- var name = ((Element) n).get_attribute_node ("name");
- var owner = ((Element) n).get_attribute_node ("owner");
+ var name = ((xElement) n).get_attribute_node ("name");
+ var owner = ((xElement) n).get_attribute_node ("owner");
if (name != null && owner != null) {
if (name.node_value == "Big" && owner.node_value == "Floor") found1 = true;
if (name.node_value == "Small" && owner.node_value == "Wall") found2 = true;
diff --git a/test/SerializableGeeHashMapTest.vala b/test/SerializableGeeHashMapTest.vala
index c435b8f..74b57bd 100644
--- a/test/SerializableGeeHashMapTest.vala
+++ b/test/SerializableGeeHashMapTest.vala
@@ -122,8 +122,8 @@ class SerializableGeeHashMapTest : GXmlTest
bool found1 = false;
bool found2 = false;
foreach (GXml.xNode n in root.child_nodes) {
- if (n is Element && n.node_name == "space") {
- var name = ((Element) n).get_attribute_node ("name");
+ if (n is xElement && n.node_name == "space") {
+ var name = ((xElement) n).get_attribute_node ("name");
if (name != null) {
if (name.node_value == "Big") found1 = true;
if (name.node_value == "Small") found2 = true;
@@ -247,8 +247,8 @@ class SerializableGeeHashMapTest : GXmlTest
bool found1 = false;
bool found2 = false;
foreach (GXml.xNode n in root.child_nodes) {
- if (n is Element && n.node_name == "space") {
- var name = ((Element) n).get_attribute_node ("name");
+ if (n is xElement && n.node_name == "space") {
+ var name = ((xElement) n).get_attribute_node ("name");
if (name != null) {
if (name.node_value == "Big") found1 = true;
if (name.node_value == "Small") found2 = true;
diff --git a/test/SerializableGeeTreeMapTest.vala b/test/SerializableGeeTreeMapTest.vala
index 42ce702..013a72d 100644
--- a/test/SerializableGeeTreeMapTest.vala
+++ b/test/SerializableGeeTreeMapTest.vala
@@ -112,8 +112,8 @@ class SerializableGeeTreeMapTest : GXmlTest
bool found1 = false;
bool found2 = false;
foreach (GXml.xNode n in root.child_nodes) {
- if (n is Element && n.node_name == "space") {
- var name = ((Element) n).get_attribute_node ("name");
+ if (n is xElement && n.node_name == "space") {
+ var name = ((xElement) n).get_attribute_node ("name");
if (name != null) {
if (name.node_value == "Big") found1 = true;
if (name.node_value == "Small") found2 = true;
@@ -231,8 +231,8 @@ class SerializableGeeTreeMapTest : GXmlTest
bool found1 = false;
bool found2 = false;
foreach (GXml.xNode n in root.child_nodes) {
- if (n is Element && n.node_name == "space") {
- var name = ((Element) n).get_attribute_node ("name");
+ if (n is xElement && n.node_name == "space") {
+ var name = ((xElement) n).get_attribute_node ("name");
if (name != null) {
if (name.node_value == "Big") found1 = true;
if (name.node_value == "Small") found2 = true;
diff --git a/test/SerializableObjectModelTest.vala b/test/SerializableObjectModelTest.vala
index ac7c21c..0fda03b 100644
--- a/test/SerializableObjectModelTest.vala
+++ b/test/SerializableObjectModelTest.vala
@@ -132,7 +132,7 @@ public class Package : ObjectModel
for (int i = 0; i < tags.length; i++) {
var str = tags.index (i);
node = element.owner_document.create_element ("tag");
- ((Element) node).content = str;
+ ((xElement) node).content = str;
element.append_child (node);
}
}
@@ -140,7 +140,7 @@ public class Package : ObjectModel
((Serializable) this).deserialize_unknown_property.connect ( (element, prop) => {
//GLib.message (@"Deserializing Unknown Property: $(prop.name) | $(prop.get_nick ())");
if (element.node_name == "tag") {
- tags.append_val (((Element) element).content);
+ tags.append_val (((xElement) element).content);
}
});
}
@@ -378,7 +378,7 @@ class SerializableObjectModelTest : GXmlTest
assert_not_reached ();
}
if (manual.get_contents () != "This is an Specification file") {
- stdout.printf (@"ERROR MANUAL: Bad Element content value. Expected 'This is an
Specification file', got: $(manual.get_contents ())\n");
+ stdout.printf (@"ERROR MANUAL: Bad xElement content value. Expected 'This is an
Specification file', got: $(manual.get_contents ())\n");
assert_not_reached ();
}
}
@@ -395,10 +395,10 @@ class SerializableObjectModelTest : GXmlTest
try {
manual.serialize (doc);
if (doc.document_element.node_name != "manual") {
- stdout.printf (@"ERROR MANUAL: Element: $(doc.document_element.node_name)\n");
+ stdout.printf (@"ERROR MANUAL: xElement: $(doc.document_element.node_name)\n");
assert_not_reached ();
}
- Element element = doc.document_element;
+ xElement element = doc.document_element;
serialize_manual_check (element, manual);
} catch (GLib.Error e) {
stdout.printf (@"$(e.message)");
@@ -466,10 +466,10 @@ class SerializableObjectModelTest : GXmlTest
try {
package.serialize (doc);
if (doc.document_element.node_name != "package") {
- stdout.printf (@"ERROR MANUAL: Element: $(doc.document_element.node_name)\n");
+ stdout.printf (@"ERROR MANUAL: xElement: $(doc.document_element.node_name)\n");
assert_not_reached ();
}
- Element element = doc.document_element;
+ xElement element = doc.document_element;
var source = element.get_attribute_node ("source");
if (source == null ) assert_not_reached ();
if (source.node_value != "Mexico") {
@@ -530,19 +530,19 @@ class SerializableObjectModelTest : GXmlTest
//stdout.printf (@"$(doc)");
if (doc.document_element.node_name != "package")
assert_not_reached ();
- Element element = doc.document_element;
+ xElement element = doc.document_element;
bool com = false;
bool cus = false;
bool sal = false;
foreach (GXml.xNode n in element.child_nodes) {
- //stdout.printf (@"Found Element: $(n.node_name)");
+ //stdout.printf (@"Found xElement: $(n.node_name)");
if (n.node_name == "tag") {
//stdout.printf (@"Found: $(n.node_name)");
- if (((Element) n).content == "Computer")
+ if (((xElement) n).content == "Computer")
com = true;
- if (((Element) n).content == "Customer")
+ if (((xElement) n).content == "Customer")
cus = true;
- if (((Element) n).content == "Sale")
+ if (((xElement) n).content == "Sale")
sal = true;
}
}
@@ -576,12 +576,12 @@ class SerializableObjectModelTest : GXmlTest
monitor.serialize (doc);
//stdout.printf (@"DOC: [$(doc)]");
if (doc.document_element == null) {
- stdout.printf ("ERROR MONITOR: No root Element");
+ stdout.printf ("ERROR MONITOR: No root xElement");
assert_not_reached ();
}
- Element element = doc.document_element;
+ xElement element = doc.document_element;
if (element.node_name != "monitor") {
- stdout.printf (@"ERROR MONITOR: root Element $(element.node_name)");
+ stdout.printf (@"ERROR MONITOR: root xElement $(element.node_name)");
assert_not_reached ();
}
var ac = element.get_attribute_node ("AcPower");
@@ -706,7 +706,7 @@ class SerializableObjectModelTest : GXmlTest
stdout.printf ("DOC: No root element");
assert_not_reached ();
}
- Element element = doc.document_element;
+ xElement element = doc.document_element;
if (element.node_name != "Configuration") {
stdout.printf (@"CONFIGURATION: Bad node name: $(element.node_name)");
assert_not_reached ();
@@ -831,8 +831,8 @@ class SerializableObjectModelTest : GXmlTest
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: node UnknownNode not found");
assert_not_reached ();
}var unknown_node = unknown_property.unknown_serializable_property.get
("UnknownNode");
- if (!(unknown_node is Element)) {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: unknown node is not an GXml.Element");
+ if (!(unknown_node is xElement)) {
+ stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: unknown node is not an GXml.xElement");
assert_not_reached ();
}
}
@@ -860,12 +860,12 @@ class SerializableObjectModelTest : GXmlTest
var doc2 = new xDocument ();
unknown_property.serialize (doc2);
if (doc2.document_element == null) {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: SERIALIZATION: No Root Element");
+ stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: SERIALIZATION: No Root xElement");
assert_not_reached ();
}
- Element element = doc2.document_element;
+ xElement element = doc2.document_element;
if (element.node_name.down () != "unknownattribute") {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: SERIALIZATION: Root Element Bad name
$(element.node_name.down ())");
+ stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: SERIALIZATION: Root xElement Bad name
$(element.node_name.down ())");
assert_not_reached ();
}
var ignore = element.get_attribute_node ("ignore");
@@ -898,7 +898,7 @@ class SerializableObjectModelTest : GXmlTest
foreach (GXml.xNode n in element.child_nodes) {
if (n.node_name == "UnknownNode") {
found = true;
- var direction = ((Element) n).get_attribute_node ("direction");
+ var direction = ((xElement) n).get_attribute_node ("direction");
if (direction == null) {
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: SERIALIZATION: UnknownNode No
attribute direction");
assert_not_reached ();
@@ -949,7 +949,7 @@ class SerializableObjectModelTest : GXmlTest
foreach (GXml.xNode n in ndoc.document_element.child_nodes) {
if (n is Text) {
if (n.node_value != "TEXT") {
- stdout.printf (@"ERROR: Unknown Text Element not set: found
'$(n.node_value)\n");
+ stdout.printf (@"ERROR: Unknown Text xElement not set: found
'$(n.node_value)\n");
assert_not_reached ();
}
}
@@ -993,7 +993,7 @@ class SerializableObjectModelTest : GXmlTest
}
});
}
- static void serialize_manual_check (Element element, Manual manual)
+ static void serialize_manual_check (xElement element, Manual manual)
{
var document = element.get_attribute_node ("document");
if (document == null) assert_not_reached ();
diff --git a/test/SerializableTest.vala b/test/SerializableTest.vala
index 456ea9c..8fdf5b6 100644
--- a/test/SerializableTest.vala
+++ b/test/SerializableTest.vala
@@ -111,7 +111,7 @@ public class SerializableCapsicum : GXml.SerializableJson {
case "ratings":
this.ratings = new GLib.List<int> ();
foreach (GXml.xNode rating in element.child_nodes) {
- int64.try_parse (((GXml.Element)rating).content, out outvalue);
+ int64.try_parse (((GXml.xElement)rating).content, out outvalue);
this.ratings.append ((int)outvalue.get_int64 ());
}
break;
@@ -126,7 +126,7 @@ public class SerializableCapsicum : GXml.SerializableJson {
switch (prop.name) {
case "ratings":
foreach (int rating_int in ratings) {
- Element n = doc.create_element ("rating");
+ xElement n = doc.create_element ("rating");
n.content = "%d".printf (rating_int);
element.append_child (n);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]