[gxml] Using direct cast to avoid future warnings



commit c1e4215abb742710b3792580c147ede770535577
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Oct 10 12:32:15 2019 -0500

    Using direct cast to avoid future warnings

 examples/vala/example.vala                         |   8 +-
 gxml/BaseCollection.vala                           |   2 +-
 gxml/CssSelectorParser.vala                        |   2 +-
 gxml/Document.vala                                 |   6 +-
 gxml/DomCharacter.vala                             |   4 +-
 gxml/DomNode.vala                                  |   8 +-
 gxml/Element.vala                                  | 120 ++++++++++-----------
 gxml/HashMap.vala                                  |   4 +-
 gxml/HashPairedMap.vala                            |  10 +-
 gxml/HashThreeMap.vala                             |  12 +--
 gxml/Node.vala                                     |  14 +--
 gxml/Object.vala                                   |  14 +--
 gxml/Parser.vala                                   |   4 +-
 gxml/Range.vala                                    |   6 +-
 gxml/SettableTokenList.vala                        |   2 +-
 gxml/StreamReader.vala                             |   6 +-
 gxml/TokenList.vala                                |   4 +-
 gxml/XAttribute.vala                               |   2 +-
 gxml/XDocument.vala                                |  16 +--
 gxml/XElement.vala                                 |  14 +--
 gxml/XHashMapAttr.vala                             |  20 ++--
 gxml/XListChildren.vala                            |   2 +-
 gxml/XNode.vala                                    |  16 +--
 gxml/XParser.vala                                  |  79 +++++++-------
 gxml/XsdSchema.vala                                |   2 +-
 test/CssSelectorTest.vala                          |  12 +--
 test/DocumentTest.vala                             |  12 +--
 test/DomXDocumentTest.vala                         |  14 +--
 test/ElementTest.vala                              | 112 +++++++++----------
 test/SerializationTest.vala                        |  50 ++++-----
 ...reamReaderPerformanceAsyncReadUnparsedTest.vala |   8 +-
 ...amReaderPerformanceIterateReadUnparsedTest.vala |   2 +-
 test/StreamReaderTest.vala                         |  30 +++---
 test/XElementTest.vala                             |  12 +--
 test/XHtmlDocumentTest.vala                        |   2 +-
 test/XPathTest.vala                                |   8 +-
 36 files changed, 321 insertions(+), 318 deletions(-)
---
diff --git a/examples/vala/example.vala b/examples/vala/example.vala
index a688f44..57a2232 100755
--- a/examples/vala/example.vala
+++ b/examples/vala/example.vala
@@ -21,7 +21,7 @@ void create_a_document () throws GLib.Error {
                books.append_child (book);
        }
 
-       stdout.printf ("create_a_document:\n%s\n", (doc as GXml.Document).write_string ());
+       stdout.printf ("create_a_document:\n%s\n", ((GXml.Document) doc).write_string ());
 }
 
 void create_a_document_from_a_string () throws GLib.Error {
@@ -39,7 +39,7 @@ void create_a_document_from_a_string () throws GLib.Error {
 </Bookshelf>""";
 
        doc = new GXml.Document.from_string (xml);
-       stdout.printf ("create_a_document_from_a_string:\n%s\n", (doc as GXml.Document).write_string ());
+       stdout.printf ("create_a_document_from_a_string:\n%s\n", ((GXml.Document) doc).write_string ());
 }
 
 void create_a_document_from_a_file (string uri) throws GLib.Error {
@@ -48,7 +48,7 @@ void create_a_document_from_a_file (string uri) throws GLib.Error {
        DomDocument doc;
 
        doc = new GXml.Document.from_file (f);
-       stdout.printf ("create_a_document_from_a_file:\n%s\n", (doc as GXml.Document).write_string ());
+       stdout.printf ("create_a_document_from_a_file:\n%s\n", ((GXml.Document) doc).write_string ());
 }
 
 void create_a_document_from_a_path (string uri) throws GLib.Error {
@@ -76,7 +76,7 @@ void saving_a_document_to_a_path (string uri) throws GLib.Error {
        stdout.printf (f.get_path ()+"\n");
        doc = new GXml.Document.from_string (xml);
        if (f.query_exists ()) f.delete ();
-       (doc as GXml.Document).write_file (f);
+       ((GXml.Document) doc).write_file (f);
        if (!f.query_exists ()) stdout.printf ("Can't save file bookshelf2.xml");
 }
 
diff --git a/gxml/BaseCollection.vala b/gxml/BaseCollection.vala
index 9ce6080..6cd91d5 100644
--- a/gxml/BaseCollection.vala
+++ b/gxml/BaseCollection.vala
@@ -148,7 +148,7 @@ public abstract class GXml.BaseCollection : GLib.Object, Traversable<DomElement>
     for (int i = 0; i < _element.child_nodes.size; i++) {
       var n = _element.child_nodes.get (i);
       if (n is GXml.Object) {
-        if ((n as DomElement).local_name.down () == items_name.down ()) {
+        if (((DomElement) n).local_name.down () == items_name.down ()) {
           if (validate_append (i, n as DomElement))
             _nodes_index.push_tail (i);
         }
diff --git a/gxml/CssSelectorParser.vala b/gxml/CssSelectorParser.vala
index 5ebf02b..9bd7d27 100644
--- a/gxml/CssSelectorParser.vala
+++ b/gxml/CssSelectorParser.vala
@@ -671,7 +671,7 @@ public class GXml.CssSelectorParser : GLib.Object {
                        return sel.local_name == element.local_name && sel.prefix == element.prefix;
                }
                if (selector is GXml.CssNotSelector)
-                       return !match_element (element, element, (selector as GXml.CssNotSelector).selectors);
+                       return !match_element (element, element, ((GXml.CssNotSelector) selector).selectors);
                if (selector.selector_type == GXml.CssSelectorType.PSEUDO_CLASS)
                        return match_pseudo (element, selector);
                return false;
diff --git a/gxml/Document.vala b/gxml/Document.vala
index 71a0aaf..fc6b055 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -241,7 +241,7 @@ public class GXml.Document : GXml.Node,
         throw new GXml.DomError.HIERARCHY_REQUEST_ERROR (_("Can't import a non Element type node to a 
Document"));
       GXml.DomNode dst = null;
       if (node is DomElement) {
-        dst = (this as DomDocument).create_element (node.node_name);
+        dst = ((DomDocument) this).create_element (node.node_name);
         GXml.DomNode.copy (this, dst, node, deep);
         if (document_element == null) {
           this.append_child (dst);
@@ -251,9 +251,9 @@ public class GXml.Document : GXml.Node,
       if (node is DomText)
         dst = this.create_text_node ((node as DomText).data);
       if (node is DomComment)
-        dst = (this as DomDocument).create_comment ((node as DomComment).data);
+        dst = ((DomDocument) this).create_comment (((DomComment) node).data);
       if (node is DomProcessingInstruction)
-        dst = this.create_processing_instruction ((node as DomProcessingInstruction).target, (node as 
DomProcessingInstruction).data);
+        dst = this.create_processing_instruction (((DomProcessingInstruction) node).target, (node as 
DomProcessingInstruction).data);
       if (dst != null) {
         document_element.append_child (dst as DomNode);
         return dst;
diff --git a/gxml/DomCharacter.vala b/gxml/DomCharacter.vala
index 79a5bae..d378653 100644
--- a/gxml/DomCharacter.vala
+++ b/gxml/DomCharacter.vala
@@ -91,10 +91,10 @@ public interface GXml.DomText : GXml.DomCharacterData {
       Init.init ();
       string s = "";
       if (this.previous_sibling is DomText)
-        s += (this.previous_sibling as DomText).whole_text;
+        s += ((DomText) this.previous_sibling).whole_text;
       s += data;
       if (this.next_sibling is DomText)
-        s += (this.next_sibling as DomText).whole_text;
+        s += ((DomText) this.next_sibling).whole_text;
       return s;
     }
   }
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index 10748e4..3f562d7 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -82,7 +82,7 @@ public interface GXml.DomNode : GLib.Object, GXml.DomEventTarget {
   public abstract DomNode append_child (DomNode node) throws GLib.Error;
   public abstract DomNode replace_child (DomNode node, DomNode child) throws GLib.Error;
   public abstract DomNode remove_child (DomNode child) throws GLib.Error;
-    /**
+  /**
    * Copy a {@link GXml.DomNode} relaying on {@link GXml.DomDocument} to other {@link GXml.DomNode}.
    *
    * {@link node} could belongs from different {@link GXml.DomDocument}, while source is a node
@@ -109,7 +109,7 @@ public interface GXml.DomNode : GLib.Object, GXml.DomEventTarget {
       GLib.message ("Copying source and destiny nodes are GXml.Elements... copying...");
       GLib.message ("Copying source's attributes to destiny node");
 #endif
-      foreach (GXml.DomNode p in (source as DomElement).attributes.values) {
+      foreach (GXml.DomNode p in ((DomElement) source).attributes.values) {
         ((GXml.DomElement) node).set_attribute (p.node_name, p.node_value); // TODO: Namespace
       }
       if (!deep) return true;
@@ -129,12 +129,12 @@ public interface GXml.DomNode : GLib.Object, GXml.DomEventTarget {
           } catch {}
         }
         if (c is DomText) {
-          if ((c as DomText).data == null) {
+          if (((DomText) c).data == null) {
             GLib.warning (_("Text node with NULL string"));
             continue;
           }
           try {
-            var t = doc.create_text_node ((c as DomText).data);
+            var t = doc.create_text_node (((DomText) c).data);
             node.child_nodes.add (t);
           } catch (GLib.Error e) {
             GLib.warning (_("Can't copy child text node"));
diff --git a/gxml/Element.vala b/gxml/Element.vala
index 5e0aff2..ae74165 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -120,39 +120,39 @@ public class GXml.Element : GXml.Node,
    * Uses element's {@link GXml.Document} to write an XML to a file, serializing it.
    */
   public void write_file (GLib.File f, Cancellable? cancellable = null) throws GLib.Error {
-    (this.owner_document as GXml.Document).write_file (f);
+    ((GXml.Document) this.owner_document).write_file (f);
   }
   /**
    * Uses element's {@link GXml.Document} to write asynchronically an XML to a file, serializing it.
    */
   public async void write_file_async (GLib.File f, Cancellable? cancellable = null) throws GLib.Error {
-    yield (this.owner_document as GXml.Document).write_file_async (f);
+    yield ((GXml.Document) this.owner_document).write_file_async (f);
   }
   /**
    * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
    */
   public void write_stream (GLib.OutputStream stream) throws GLib.Error {
-    (this.owner_document as GXml.Document).write_stream (stream);
+    ((GXml.Document) this.owner_document).write_stream (stream);
   }
   /**
    * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
    */
   public async void write_stream_async (GLib.OutputStream stream, Cancellable? cancellable = null) throws 
GLib.Error {
-    yield (this.owner_document as GXml.Document).write_stream_async (stream);
+    yield ((GXml.Document) this.owner_document).write_stream_async (stream);
   }
   /**
    * Creates an {@link GLib.InputStream} to write a string representation
    * in XML of {@link GXml.Element} using node's {@link GXml.Document}
    */
   public InputStream create_stream () throws GLib.Error {
-    return (this.owner_document as GXml.Document).create_stream ();
+    return ((GXml.Document) this.owner_document).create_stream ();
   }
   /**
    * Creates an {@link GLib.InputStream} to write a string representation
    * in XML of {@link GXml.Element} using node's {@link GXml.Document}
    */
   public async InputStream create_stream_async (Cancellable? cancellable = null) throws GLib.Error {
-    return yield (this.owner_document as GXml.Document).create_stream_async ();
+    return yield ((GXml.Document) this.owner_document).create_stream_async ();
   }
   // DomNode overrides
   public new string? lookup_prefix (string? nspace) {
@@ -319,8 +319,8 @@ public class GXml.Element : GXml.Node,
    * An attribute called 'class'.
    */
   public string? class_name {
-    owned get { return (this as GXml.Element).get_attribute ("class"); }
-    set { (this as GXml.Object).set_attribute ("class", value); }
+    owned get { return ((GXml.Element) this).get_attribute ("class"); }
+    set { ((GXml.Object) this).set_attribute ("class", value); }
   }
   /**
    * A list of values of all attributes called 'class'.
@@ -425,7 +425,7 @@ public class GXml.Element : GXml.Node,
 
     public DomNode? get_named_item (string name) {
       if (name == "") return null;
-      var ov = (_element as GXml.Object).get_attribute (name);
+      var ov = ((GXml.Object) _element).get_attribute (name);
       if (ov != null) {
         return new GXml.Attr (_element, name, ov);
       }
@@ -464,21 +464,21 @@ public class GXml.Element : GXml.Node,
      * namespace
      */
     public DomNode? set_named_item (DomNode node) throws GLib.Error {
-      if ((":" in (node as GXml.Attr).local_name)
-          || (node as GXml.Attr).local_name == "")
-        throw new DomError.INVALID_CHARACTER_ERROR (_("Invalid attribute name: %s"), (node as 
GXml.Attr).local_name);
+      if ((":" in ((GXml.Attr) node).local_name)
+          || ((GXml.Attr) node).local_name == "")
+        throw new DomError.INVALID_CHARACTER_ERROR (_("Invalid attribute name: %s"), ((GXml.Attr) 
node).local_name);
       if (!(node is GXml.Attr))
         throw new DomError.HIERARCHY_REQUEST_ERROR (_("Invalid node type. GXml.Attr was expected"));
       GXml.Attr attr = null;
-      var pprop = (_element as GXml.Object).find_property_name ((node as GXml.Attr).local_name);
+      var pprop = ((GXml.Object) _element).find_property_name (((GXml.Attr) node).local_name);
       if (pprop != null) {
-        (_element as GXml.Object).set_attribute ((node as GXml.Attr).local_name, node.node_value);
-        attr = new GXml.Attr.reference (_element, (node as GXml.Attr).local_name);
+        ((GXml.Object) _element).set_attribute (((GXml.Attr) node).local_name, node.node_value);
+        attr = new GXml.Attr.reference (_element, ((GXml.Attr) node).local_name);
       } else {
-        attr = new GXml.Attr (_element, (node as GXml.Attr).local_name, node.node_value);
+        attr = new GXml.Attr (_element, ((GXml.Attr) node).local_name, node.node_value);
       }
       set (attr.local_name.down (), attr);
-      order.set (size - 1, (node as GXml.Attr).local_name.down ());
+      order.set (size - 1, ((GXml.Attr) node).local_name.down ());
       return attr;
     }
     public DomNode? remove_named_item (string name) throws GLib.Error {
@@ -531,65 +531,65 @@ public class GXml.Element : GXml.Node,
     }
     // Introduced in DOM Level 2:
     public DomNode? set_named_item_ns (DomNode node) throws GLib.Error {
-      if ((node as GXml.Attr).local_name == "" || ":" in (node as GXml.Attr).local_name)
-        throw new DomError.INVALID_CHARACTER_ERROR (_("Invalid attribute name: %s"),(node as 
GXml.Attr).local_name);
-      if (!(node is GXml.Attr))
+      if (((GXml.Attr) node).local_name == "" || ":" in ((GXml.Attr) node).local_name)
+        throw new DomError.INVALID_CHARACTER_ERROR (_("Invalid attribute name: %s"),((GXml.Attr) 
node).local_name);
+      if (!( node is GXml.Attr))
         throw new DomError.HIERARCHY_REQUEST_ERROR (_("Invalid node type. GXml.Attr was expected"));
 
-      if ((node as GXml.Attr).prefix == "xmlns"
-          && (node as GXml.Attr).namespace_uri != "http://www.w3.org/2000/xmlns/";
-              && (node as GXml.Attr).namespace_uri != "http://www.w3.org/2000/xmlns";)
+      if (((GXml.Attr) node).prefix == "xmlns"
+          && ((GXml.Attr) node).namespace_uri != "http://www.w3.org/2000/xmlns/";
+              && ((GXml.Attr) node).namespace_uri != "http://www.w3.org/2000/xmlns";)
         throw new DomError.NAMESPACE_ERROR (_("Namespace attributes prefixed with xmlns should use a 
namespace uri http://www.w3.org/2000/xmlns";));
-      if ((node as GXml.Attr).prefix == ""
-          || (node as GXml.Attr).prefix == null
-          && (node as GXml.Attr).local_name != "xmlns") {
-        string s = (node as GXml.Attr).local_name;
-        if ((node as GXml.Attr).namespace_uri != null)
-          s += "=<"+(node as GXml.Attr).namespace_uri+">";
+      if (((GXml.Attr) node).prefix == ""
+          || ((GXml.Attr) node).prefix == null
+          && ((GXml.Attr) node).local_name != "xmlns") {
+        string s = ((GXml.Attr) node).local_name;
+        if (((GXml.Attr) node).namespace_uri != null)
+          s += "=<"+((GXml.Attr) node).namespace_uri+">";
         throw new DomError.NAMESPACE_ERROR (_("Namespaced attributes should provide a non-null, non-empty 
prefix: %s"),s);
       }
-      if ((node as GXml.Attr).prefix == "xmlns"
-          && (node as GXml.Attr).local_name == "xmlns")
+      if (((GXml.Attr) node).prefix == "xmlns"
+          && ((GXml.Attr) node).local_name == "xmlns")
         throw new DomError.NAMESPACE_ERROR (_("Invalid namespace attribute's name."));
-      if ((node as GXml.Attr).prefix == "xmlns"
-          || (node as GXml.Attr).local_name == "xmlns"
-          || (node as GXml.Attr).prefix == "xsi") {
+      if (((GXml.Attr) node).prefix == "xmlns"
+          || ((GXml.Attr) node).local_name == "xmlns"
+          || ((GXml.Attr) node).prefix == "xsi") {
         string asp = _element.get_attribute_ns (node.node_value,
-                                          (node as GXml.Attr).local_name);
+                                          ((GXml.Attr) node).local_name);
         if (asp != null) return node;
       }
-      if ((node as GXml.Attr).namespace_uri != "http://www.w3.org/2000/xmlns/";
-          && (node as GXml.Attr).namespace_uri != "http://www.w3.org/2000/xmlns";
-          && (node as GXml.Attr).namespace_uri != "http://www.w3.org/2001/XMLSchema-instance/";
-          && (node as GXml.Attr).namespace_uri != "http://www.w3.org/2001/XMLSchema-instance";) {
-        string nsn = _element.lookup_namespace_uri ((node as GXml.Attr).prefix);
+      if (((GXml.Attr) node).namespace_uri != "http://www.w3.org/2000/xmlns/";
+          && ((GXml.Attr) node).namespace_uri != "http://www.w3.org/2000/xmlns";
+          && ((GXml.Attr) node).namespace_uri != "http://www.w3.org/2001/XMLSchema-instance/";
+          && ((GXml.Attr) node).namespace_uri != "http://www.w3.org/2001/XMLSchema-instance";) {
+        string nsn = _element.lookup_namespace_uri (((GXml.Attr) node).prefix);
         string nspn = _element.lookup_prefix (nsn);
-        if (nspn != (node as GXml.Attr).prefix
-            && nsn != (node as GXml.Attr).namespace_uri) {
+        if (nspn != ((GXml.Attr) node).prefix
+            && nsn != ((GXml.Attr) node).namespace_uri) {
           throw new DomError.NAMESPACE_ERROR
                   (_("Trying to add an attribute with an undefined namespace's prefix: %s").printf ((node as 
GXml.Attr).prefix));
         }
-        nspn = _element.lookup_prefix ((node as GXml.Attr).namespace_uri);
+        nspn = _element.lookup_prefix (((GXml.Attr) node).namespace_uri);
         nsn = _element.lookup_namespace_uri (nspn);
-        if (nspn != (node as GXml.Attr).prefix
-            && nsn != (node as GXml.Attr).namespace_uri)
+        if (nspn != ((GXml.Attr) node).prefix
+            && nsn != ((GXml.Attr) node).namespace_uri)
           throw new DomError.NAMESPACE_ERROR
                   (_("Trying to add an attribute with an undefined namespace's URI"));
       }
 
       string p = "";
-      if ((node as GXml.Attr).prefix != null
-          && (node as GXml.Attr).prefix != "") {
-        p = (node as GXml.Attr).prefix + ":";
+      if (((GXml.Attr) node).prefix != null
+          && ((GXml.Attr) node).prefix != "") {
+        p = ((GXml.Attr) node).prefix + ":";
       }
-      string k = (p+(node as GXml.Attr).local_name).down ();
+      string k = (p+((GXml.Attr) node).local_name).down ();
       GXml.Attr attr = null;
-      var pprop = (_element as GXml.Object).find_property_name (k);
+      var pprop = ((GXml.Object) _element).find_property_name (k);
       if (pprop != null) {
-        (_element as GXml.Object).set_attribute (k, node.node_value);
+        ((GXml.Object) _element).set_attribute (k, node.node_value);
         attr = new GXml.Attr.reference (_element, k);
       } else {
-        attr = new GXml.Attr.namespace (_element, (node as GXml.Attr).namespace_uri, (node as 
GXml.Attr).prefix, (node as GXml.Attr).local_name, node.node_value);
+        attr = new GXml.Attr.namespace (_element, ((GXml.Attr) node).namespace_uri, ((GXml.Attr) 
node).prefix, ((GXml.Attr) node).local_name, node.node_value);
       }
       set (k, attr);
       order.set (size - 1, k);
@@ -708,8 +708,8 @@ public class GXml.Element : GXml.Node,
     foreach (GXml.DomNode n in child_nodes) {
       if (!(n is DomElement)) continue;
       if (n.node_name == local_name)
-        l.add (n as DomElement);
-      l.add_all ((n as DomElement).get_elements_by_tag_name (local_name));
+        l.add ((DomElement) n);
+      l.add_all (((DomElement) n).get_elements_by_tag_name (local_name));
     }
     return l;
   }
@@ -719,9 +719,9 @@ public class GXml.Element : GXml.Node,
     foreach (GXml.DomNode n in child_nodes) {
       if (!(n is DomElement)) continue;
       if (n.node_name == local_name
-          && (n as DomElement).namespace_uri == namespace)
-        l.add (n as DomElement);
-      l.add_all ((n as DomElement).get_elements_by_tag_name_ns (namespace, local_name));
+          && ((DomElement) n).namespace_uri == namespace)
+        l.add ((DomElement) n);
+      l.add_all (((DomElement) n).get_elements_by_tag_name_ns (namespace, local_name));
     }
     return l;
   }
@@ -752,12 +752,12 @@ public class GXml.Element : GXml.Node,
         }
         if (found == cs.length) {
           if (l.size == 0)
-            l.add (n as DomElement);
+            l.add ((DomElement) n);
           else
-            l.insert (0, n as DomElement);
+            l.insert (0, (DomElement) n);
         }
       }
-      l.add_all ((n as DomElement).get_elements_by_class_name (class_names));
+      l.add_all (((DomElement) n).get_elements_by_class_name (class_names));
     }
     return l;
   }
diff --git a/gxml/HashMap.vala b/gxml/HashMap.vala
index 919f16f..815de89 100644
--- a/gxml/HashMap.vala
+++ b/gxml/HashMap.vala
@@ -141,9 +141,9 @@ public class GXml.HashMap : GXml.BaseCollection, GXml.Map {
 #endif
     string key = null;
     if (attribute_key != null) {
-      key = (element as DomElement).get_attribute (attribute_key);
+      key = ((DomElement) element).get_attribute (attribute_key);
       if (key == null)
-      key = (element as DomElement).get_attribute (attribute_key.down ());
+      key = ((DomElement) element).get_attribute (attribute_key.down ());
     } else {
       if (items_type.is_a (typeof(MappeableElement))) {
         if (!(element is MappeableElement)) return false;
diff --git a/gxml/HashPairedMap.vala b/gxml/HashPairedMap.vala
index 7cabbe8..ed4008f 100644
--- a/gxml/HashPairedMap.vala
+++ b/gxml/HashPairedMap.vala
@@ -188,16 +188,16 @@ public class GXml.HashPairedMap : GXml.BaseCollection, GXml.PairedMap {
 #if DEBUG
     message ("Validating HashMap Element..."
             +(element as GXml.Element).write_string ()
-            +" Attrs:"+(element as GXml.Element).attributes.length.to_string());
+            +" Attrs:"+((GXml.Element) element).attributes.length.to_string());
 #endif
     string pkey = null;
     string skey = null;
     if (attribute_primary_key != null && attribute_secondary_key != null) {
-      pkey = (element as DomElement).get_attribute (attribute_primary_key);
-      skey = (element as DomElement).get_attribute (attribute_secondary_key);
+      pkey = ((DomElement) element).get_attribute (attribute_primary_key);
+      skey = ((DomElement) element).get_attribute (attribute_secondary_key);
       if (pkey == null || skey == null) {
-        pkey = (element as DomElement).get_attribute (attribute_primary_key.down ());
-        skey = (element as DomElement).get_attribute (attribute_secondary_key.down ());
+        pkey = ((DomElement) element).get_attribute (attribute_primary_key.down ());
+        skey = ((DomElement) element).get_attribute (attribute_secondary_key.down ());
       }
     } else {
       if (items_type.is_a (typeof(MappeableElementPairKey))) {
diff --git a/gxml/HashThreeMap.vala b/gxml/HashThreeMap.vala
index de4e217..bfe5700 100644
--- a/gxml/HashThreeMap.vala
+++ b/gxml/HashThreeMap.vala
@@ -246,13 +246,13 @@ public class GXml.HashThreeMap : GXml.BaseCollection, ThreeMap {
     string tkey = null;
     if (attribute_primary_key != null && attribute_secondary_key != null
         && attribute_third_key != null) {
-      pkey = (element as DomElement).get_attribute (attribute_primary_key);
-      skey = (element as DomElement).get_attribute (attribute_secondary_key);
-      tkey = (element as DomElement).get_attribute (attribute_third_key);
+      pkey = ((DomElement) element).get_attribute (attribute_primary_key);
+      skey = ((DomElement) element).get_attribute (attribute_secondary_key);
+      tkey = ((DomElement) element).get_attribute (attribute_third_key);
       if (pkey == null || skey == null || tkey == null) {
-        pkey = (element as DomElement).get_attribute (attribute_primary_key.down ());
-        skey = (element as DomElement).get_attribute (attribute_secondary_key.down ());
-        tkey = (element as DomElement).get_attribute (attribute_third_key.down ());
+        pkey = ((DomElement) element).get_attribute (attribute_primary_key.down ());
+        skey = ((DomElement) element).get_attribute (attribute_secondary_key.down ());
+        tkey = ((DomElement) element).get_attribute (attribute_third_key.down ());
       }
     } else {
       if (items_type.is_a (typeof(MappeableElementThreeKey))) {
diff --git a/gxml/Node.vala b/gxml/Node.vala
index 0c58d6c..3b770cd 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -115,7 +115,7 @@ public class GXml.Node : GLib.Object,
       if (_parent == null) return null;
       if (_parent.child_nodes == null) return null;
       if (_parent.child_nodes.length == 0) return null;
-      var pos = (_parent.child_nodes as Gee.ArrayList<DomNode>).index_of (this);
+      var pos = ((Gee.ArrayList<DomNode>) _parent.child_nodes).index_of (this);
       if (pos == 0) return null;
       if ((pos - 1) > 0 && (pos - 1) < _parent.child_nodes.size)
         return _parent.child_nodes[pos - 1];
@@ -127,7 +127,7 @@ public class GXml.Node : GLib.Object,
       if (_parent == null) return null;
       if (_parent.child_nodes == null) return null;
       if (_parent.child_nodes.length == 0) return null;
-      var pos = (_parent.child_nodes as Gee.ArrayList<DomNode>).index_of (this);
+      var pos = ((Gee.ArrayList<DomNode>) _parent.child_nodes).index_of (this);
       if (pos == 0) return null;
       if ((pos + 1) > 0 && (pos + 1) < _parent.child_nodes.size)
         return _parent.child_nodes[pos + 1];
@@ -181,7 +181,7 @@ public class GXml.Node : GLib.Object,
   public bool is_equal_node (DomNode? node) { // FIXME: This is not going to work
     if (node == null) return false;
     if (this is DomCharacterData)
-      return (this as DomComment).data == (node as DomComment).data;
+      return ((DomComment) this).data == ((DomComment) node).data;
     return false;
   }
 
@@ -195,7 +195,7 @@ public class GXml.Node : GLib.Object,
        p = p & DomNode.DocumentPosition.FOLLOWING;
       return p;
     }
-    if ((this as DomNode).contains (other))
+    if (((DomNode) this).contains (other))
       return DomNode.DocumentPosition.CONTAINED_BY & DomNode.DocumentPosition.FOLLOWING;
     if (this.parent_node.contains (other)) {
       var par = this.parent_node;
@@ -218,7 +218,7 @@ public class GXml.Node : GLib.Object,
     if (this is GXml.DomDocumentType ||
         this is GXml.DomDocumentFragment) return null;
     if (this is DomElement) {
-      return (this as GXml.Element).lookup_prefix (nspace);
+      return ((GXml.Element) this).lookup_prefix (nspace);
     }
     if (this is GXml.Attr) {
       if (this.parent_node == null) return  null;
@@ -230,7 +230,7 @@ public class GXml.Node : GLib.Object,
     if (this is GXml.DomDocumentType ||
         this is GXml.DomDocumentFragment) return null;
     if (this is DomElement) {
-        return (this as GXml.Element).lookup_namespace_uri (prefix);
+        return ((GXml.Element) this).lookup_namespace_uri (prefix);
     }
     if (this is GXml.Attr) {
       if (this.parent_node == null) return  null;
@@ -291,7 +291,7 @@ public class GXml.Node : GLib.Object,
     if (owner_document != node.owner_document)
       throw new DomError.HIERARCHY_REQUEST_ERROR
               (_("Invalid attempt to append a child with different parent document"));
-    (node as GXml.Node).set_parent (this);
+    ((GXml.Node) node).set_parent (this);
     return insert_before (node, null);
   }
   public DomNode replace_child (DomNode node, DomNode child) throws GLib.Error {
diff --git a/gxml/Object.vala b/gxml/Object.vala
index a82df48..f130bf9 100644
--- a/gxml/Object.vala
+++ b/gxml/Object.vala
@@ -136,13 +136,13 @@ public interface GXml.Object : GLib.Object,
         return null;
       }
 #if DEBUG
-      if ((so as GXml.Property).value != null) {
-        message ("GXml.Property Value: "+(so as GXml.Property).value);
+      if (((GXml.Property) so).value != null) {
+        message ("GXml.Property Value: "+((GXml.Property) so).value);
       } else {
         message ("GXml.Property Value Is Null");
       }
 #endif
-      return (so as GXml.Property).value;
+      return ((GXml.Property) so).value;
     }
     if (prop.value_type.is_a (typeof (string))) {
       return (string) v;
@@ -309,8 +309,8 @@ public interface GXml.Object : GLib.Object,
         return (DomElement) ((Object) vo);
       }
     }
-    if ((this as DomNode).has_child_nodes ()) {
-      var els = (this as DomElement).get_elements_by_tag_name (name);
+    if (((DomNode) this).has_child_nodes ()) {
+      var els = ((DomElement) this).get_elements_by_tag_name (name);
       if (els.size != 0)
         return els.item (0);
     }
@@ -328,8 +328,8 @@ public interface GXml.Object : GLib.Object,
         var o = GLib.Object.new (prop.value_type) as DomElement;
         foreach (DomNode n in this.child_nodes) {
           if (!(n is DomElement)) continue;
-          if ((n as DomElement).local_name.down () == o.local_name.down ())
-            l.add (n as DomElement);
+          if (((DomElement) n).local_name.down () == o.local_name.down ())
+            l.add ((DomElement) n);
         }
       }
     }
diff --git a/gxml/Parser.vala b/gxml/Parser.vala
index f773307..9fc661c 100644
--- a/gxml/Parser.vala
+++ b/gxml/Parser.vala
@@ -204,7 +204,7 @@ public interface GXml.Parser : GLib.Object {
     element = null;
     if (!(parent is GXml.Object)) return false;
     foreach (ParamSpec pspec in
-              (parent as GXml.Object).get_property_element_list ()) {
+              ((GXml.Object) parent).get_property_element_list ()) {
       if (pspec.value_type.is_a (typeof (Collection))) continue;
       //if (!pspec.value_type.is_instantiatable ()) continue;
       var obj = GLib.Object.new (pspec.value_type,
@@ -235,7 +235,7 @@ public interface GXml.Parser : GLib.Object {
     element = null;
     if (!(parent is GXml.Object)) return false;
     foreach (ParamSpec pspec in
-              (parent as GXml.Object).get_property_element_list ()) {
+              ((GXml.Object) parent).get_property_element_list ()) {
       if (!(pspec.value_type.is_a (typeof (Collection)))) continue;
       Collection col;
       Value vc = Value (pspec.value_type);
diff --git a/gxml/Range.vala b/gxml/Range.vala
index 9890710..8da0f79 100644
--- a/gxml/Range.vala
+++ b/gxml/Range.vala
@@ -56,7 +56,7 @@ public class GXml.Range : GLib.Object, GXml.DomRange {
                                throw new DomError.INDEX_SIZE_ERROR (_("Invalid offset for node to start: for 
document type"));
                else
                        if (node is DomCharacterData)
-                               if (offset > (node as DomCharacterData).length)
+                               if (offset > ((DomCharacterData) node).length)
                                        throw new DomError.INDEX_SIZE_ERROR (_("Invalid offset for node to 
start: for character data"));
                        else
                                if (offset > node.child_nodes.length)
@@ -84,7 +84,7 @@ public class GXml.Range : GLib.Object, GXml.DomRange {
                                throw new DomError.INDEX_SIZE_ERROR (_("Invalid offset for node to start: for 
document type"));
                else
                        if (node is DomCharacterData)
-                               if (offset > (node as DomCharacterData).length)
+                               if (offset > ((DomCharacterData) node).length)
                                        throw new DomError.INDEX_SIZE_ERROR (_("Invalid offset for node to 
start: for character data"));
                        else
                                if (offset > node.child_nodes.length)
@@ -156,7 +156,7 @@ public class GXml.Range : GLib.Object, GXml.DomRange {
                int length = 0;
                if (node is DomDocumentType) length = 0;
                else
-                       if (node is DomCharacterData) length = (node as DomCharacterData).length;
+                       if (node is DomCharacterData) length = ((DomCharacterData) node).length;
                                else
                                        length = node.child_nodes.length;
                set_end (node, length);
diff --git a/gxml/SettableTokenList.vala b/gxml/SettableTokenList.vala
index ae24fc2..cbf8bab 100644
--- a/gxml/SettableTokenList.vala
+++ b/gxml/SettableTokenList.vala
@@ -31,7 +31,7 @@ public class GXml.SettableTokenList : GXml.TokenList, GXml.DomSettableTokenList
     set {
       string[] s = value.split (" ");
       for (int i = 0; i < s.length; i++) {
-        (this as Gee.ArrayList<string>).add (s[i]);
+        ((Gee.ArrayList<string>) this).add (s[i]);
       }
     }
   }
diff --git a/gxml/StreamReader.vala b/gxml/StreamReader.vala
index 5198bd0..d4d7022 100644
--- a/gxml/StreamReader.vala
+++ b/gxml/StreamReader.vala
@@ -161,7 +161,7 @@ public class GXml.StreamReader : GLib.Object {
     }
     name_buf.put_byte ('\0', cancellable);
     if (document.document_element == null) {
-      e = (document as GXml.Document).search_root_element_property ();
+      e = ((GXml.Document) document).search_root_element_property ();
     }
     if (e == null) {
       e = (GXml.Element) document.create_element ((string) oname_buf.get_data ());
@@ -171,7 +171,7 @@ public class GXml.StreamReader : GLib.Object {
     }
     if (document.document_element == e && parent == null) {
       foreach (ParamSpec pspec in
-                (e as GXml.Object).get_property_element_list ()) {
+                ((GXml.Object) e).get_property_element_list ()) {
         if (!(pspec.value_type.is_a (typeof (Collection)))) continue;
         Collection col;
         Value vc = Value (pspec.value_type);
@@ -231,7 +231,7 @@ public class GXml.StreamReader : GLib.Object {
             col.append (cobj);
           } else {
             foreach (ParamSpec pspec in
-                (e as GXml.Object).get_property_element_list ()) {
+                ((GXml.Object) e).get_property_element_list ()) {
               if (pspec.value_type.is_a (typeof (Collection))) continue;
               var obj = GLib.Object.new (pspec.value_type,
                                     "owner-document", document) as Element;
diff --git a/gxml/TokenList.vala b/gxml/TokenList.vala
index 1ca20ce..79ed103 100644
--- a/gxml/TokenList.vala
+++ b/gxml/TokenList.vala
@@ -41,10 +41,10 @@ public class GXml.TokenList : Gee.ArrayList<string>, GXml.DomTokenList {
       if (" " in av) {
         string[] s = av.split (" ");
         for (int i = 0; i < s.length; i++) {
-          (this as Gee.ArrayList<string>).add (s[i]);
+          ((Gee.ArrayList<string>) this).add (s[i]);
         }
       } else {
-        (this as Gee.ArrayList<string>).add (av);
+        ((Gee.ArrayList<string>) this).add (av);
       }
     }
   }
diff --git a/gxml/XAttribute.vala b/gxml/XAttribute.vala
index 43905c2..64cf747 100644
--- a/gxml/XAttribute.vala
+++ b/gxml/XAttribute.vala
@@ -84,7 +84,7 @@ public class GXml.XAttribute : GXml.XNode, GXml.DomAttr
       return namespace.prefix;
     }
   }*/
-  public string local_name { owned get { return (this as GXml.XNode).name; } }
+  public string local_name { owned get { return ((GXml.XNode) this).name; } }
   /*public string GXml.DomAttr.name {
     get {
       if (namespace == null) return (this as GXml.DomNode).name;
diff --git a/gxml/XDocument.vala b/gxml/XDocument.vala
index c166956..6c61baf 100644
--- a/gxml/XDocument.vala
+++ b/gxml/XDocument.vala
@@ -209,8 +209,8 @@ public class GXml.XDocument : GXml.XNode,
         prefix = s[0];
         qname = s[1];
       }
-      var e = (this as GXml.DomDocument).create_element (qname);
-      (e as XElement).set_namespace (ns, prefix);
+      var e = ((GXml.DomDocument) this).create_element (qname);
+      ((XElement) e).set_namespace (ns, prefix);
       return e as DomElement;
   }
 
@@ -254,7 +254,7 @@ public class GXml.XDocument : GXml.XNode,
         throw new GXml.DomError.HIERARCHY_REQUEST_ERROR (_("Can't import a non Element type node to a 
Document"));
       GXml.DomNode dst = null;
       if (node is DomElement) {
-        dst = (this as DomDocument).create_element (node.node_name);
+        dst = ((DomDocument) this).create_element (node.node_name);
         GXml.DomNode.copy (this, (GXml.DomNode) dst, (GXml.DomNode) node, deep);
         if (document_element == null) {
           this.append_child (dst);
@@ -264,9 +264,9 @@ public class GXml.XDocument : GXml.XNode,
       if (node is DomText)
         dst = this.create_text_node ((node as DomText).data);
       if (node is DomComment)
-        dst = (this as DomDocument).create_comment ((node as DomComment).data);
+        dst = ((DomDocument) this).create_comment (((DomComment) node).data);
       if (node is DomProcessingInstruction)
-        dst = this.create_processing_instruction ((node as DomProcessingInstruction).target, (node as 
DomProcessingInstruction).data);
+        dst = this.create_processing_instruction (((DomProcessingInstruction) node).target, (node as 
DomProcessingInstruction).data);
       if (dst != null) {
         document_element.append_child (dst as DomNode);
         return dst;
@@ -329,10 +329,10 @@ public class GXml.XDocument : GXml.XNode,
     }
   }
   public DomElement? first_element_child {
-    owned get { return (DomElement) (this as DomDocument).child_nodes.first (); }
+    owned get { return (DomElement) ((DomDocument) this).child_nodes.first (); }
   }
   public DomElement? last_element_child {
-    owned get { return (DomElement) (this as DomDocument).child_nodes.last (); }
+    owned get { return (DomElement) ((DomDocument) this).child_nodes.last (); }
   }
   public int child_element_count { get { return child_nodes.size; } }
 
@@ -364,7 +364,7 @@ public class GXml.XDocument : GXml.XNode,
     XPathObject nullobj = null;
     if (document_element == null)
       return nullobj;
-    return (document_element as XPathContext).evaluate (expression, resolver);
+    return ((XPathContext) document_element).evaluate (expression, resolver);
   }
 }
 
diff --git a/gxml/XElement.vala b/gxml/XElement.vala
index a05687b..ef50531 100644
--- a/gxml/XElement.vala
+++ b/gxml/XElement.vala
@@ -190,28 +190,28 @@ public class GXml.XElement : GXml.XNonDocumentChildNode,
     owned get {
         var p = attrs.get ("id");
         if (p == null) return null;
-        return (p as XNode).value;
+        return ((XNode) p).value;
     }
     set {
         var p = attrs.get ("id");
         if (p == null)
             set_attr ("id",value);
         else
-            (p as XNode).value = value;
+            ((XNode) p).value = value;
     }
   }
   public string? class_name {
     owned get {
         var p = attrs.get ("class");
         if (p == null) return null;
-        return (p as XNode).value;
+        return ((XNode) p).value;
     }
     set {
         var p = attrs.get ("class");
         if (p == null)
             set_attr ("class",value);
         else
-            (p as XNode).value = value;
+            ((XNode) p).value = value;
     }
   }
   public DomTokenList class_list {
@@ -224,12 +224,12 @@ public class GXml.XElement : GXml.XNonDocumentChildNode,
   public string? get_attribute (string name) {
     var p = attrs.get (name);
     if (p == null) return null;
-    return (p as XNode).value;
+    return ((XNode) p).value;
   }
   public string? get_attribute_ns (string? namespace, string local_name) {
     var p = get_ns_attr (local_name, namespace);
     if (p == null) return null;
-    return (p as XNode).value;
+    return ((XNode) p).value;
   }
   public void set_attribute (string name, string value) throws GLib.Error { set_attr (name, value); }
   public void set_attribute_ns (string? namespace, string name, string value) throws GLib.Error {
@@ -336,7 +336,7 @@ public class GXml.XElement : GXml.XNonDocumentChildNode,
     GXml.XPathObject nullobj = null;
     if (!(this is GXml.DomNode))
       return nullobj;
-    string data = (this as GXml.XNode).to_string();
+    string data = ((XNode) this).to_string();
     var ndoc = Xml.Parser.read_memory (data, data.length);
     var gdoc = new GXml.XDocument.from_doc (ndoc);
     var context = new Xml.XPath.Context (ndoc);
diff --git a/gxml/XHashMapAttr.vala b/gxml/XHashMapAttr.vala
index b08e224..aa1e6fb 100644
--- a/gxml/XHashMapAttr.vala
+++ b/gxml/XHashMapAttr.vala
@@ -248,7 +248,7 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.XNode>,
     if (_parent is GXml.DomElement && !(node is GXml.DomAttr))
       throw new GXml.DomError.HIERARCHY_REQUEST_ERROR (_("Trying to add an object to an Element, but it is 
not an attribute"));
     if (_parent is DomElement) {
-      (_parent as DomElement).set_attribute (node.node_name, node.node_value);
+      ((DomElement) _parent).set_attribute (node.node_name, node.node_value);
       return node;
     }
     return null;
@@ -263,7 +263,7 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.XNode>,
       throw new GXml.DomError.NO_MODIFICATION_ALLOWED_ERROR (_("Node collection is read only"));
     if (_parent is DomElement) {
       var a = _parent.attributes.get_named_item (name);
-      (_parent as XNode).get_internal_node ()->set_prop (name, null);
+      ((XNode) _parent).get_internal_node ()->set_prop (name, null);
       return a;
     }
     return null;
@@ -274,12 +274,12 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.XNode>,
       string uri = "";
       if (!(n is DomElement || n is DomAttr)) continue;
       if (n is DomElement) {
-        if ((n as DomElement).namespace_uri == null) continue;
-        uri = (n as DomElement).namespace_uri;
+        if (((DomElement) n).namespace_uri == null) continue;
+        uri = ((DomElement) n).namespace_uri;
       }
       if (n is DomAttr) {
-        if ((n as DomAttr).namespace_uri == null) continue;
-        uri = (n as DomAttr).namespace_uri;
+        if (((DomAttr) n).namespace_uri == null) continue;
+        uri = ((DomAttr) n).namespace_uri;
       }
       if (uri == namespace_uri && n.node_name == local_name)
         return (GXml.DomNode?) n;
@@ -301,9 +301,9 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.XNode>,
       throw new GXml.DomError.HIERARCHY_REQUEST_ERROR (_("Trying to add an object to an Element, but it is 
not an attribute"));
     // FIXME: Detects if no namespace is supported to rise exception  NOT_SUPPORTED_ERROR
     if (_parent is DomElement && node is DomAttr) {
-      (_parent as DomElement).set_attribute_ns ((node as DomAttr).prefix+":"+(node as DomAttr).namespace_uri,
+      ((DomElement) _parent).set_attribute_ns (((DomAttr) node).prefix+":"+((DomAttr) node).namespace_uri,
                                                node.node_name, node.node_value);
-      return _parent.attributes.get_named_item_ns ((node as DomAttr).prefix+":"+(node as 
DomAttr).namespace_uri, node.node_name);
+      return _parent.attributes.get_named_item_ns (((DomAttr) node).prefix+":"+((DomAttr) 
node).namespace_uri, node.node_name);
     }
     return null;
   }
@@ -319,9 +319,9 @@ public class GXml.XHashMapAttr : Gee.AbstractMap<string,GXml.XNode>,
       throw new GXml.DomError.NO_MODIFICATION_ALLOWED_ERROR (_("Node collection is read only"));
     // FIXME: Detects if no namespace is supported to rise exception  NOT_SUPPORTED_ERROR
     if (_parent is DomElement) {
-      var ns = (_parent as XNode).get_internal_node ()->doc->search_ns_by_href ((_parent as 
XNode).get_internal_node (),
+      var ns = ((XNode) _parent).get_internal_node ()->doc->search_ns_by_href (((XNode) 
_parent).get_internal_node (),
                                                               namespace_uri);
-      (_parent as XNode).get_internal_node ()->set_ns_prop (ns, local_name, null);
+      ((XNode) _parent).get_internal_node ()->set_ns_prop (ns, local_name, null);
       return n;
     }
     return null;
diff --git a/gxml/XListChildren.vala b/gxml/XListChildren.vala
index 4df7dee..01c248a 100644
--- a/gxml/XListChildren.vala
+++ b/gxml/XListChildren.vala
@@ -70,7 +70,7 @@ public class GXml.XListChildren : AbstractBidirList<GXml.DomNode>,
   public override void insert (int index, GXml.DomNode item) {
     var n = @get (index);
     if (n == null) return;
-    (n as GXml.XNode).get_internal_node ()->add_prev_sibling ((item as GXml.XNode).get_internal_node ());
+    ((GXml.XNode) n).get_internal_node ()->add_prev_sibling (((GXml.XNode) item).get_internal_node ());
   }
   public override  Gee.ListIterator<GXml.DomNode> list_iterator () { return new Iterator (_doc, _node); }
   /**
diff --git a/gxml/XNode.vala b/gxml/XNode.vala
index 3551ad0..3b8546f 100644
--- a/gxml/XNode.vala
+++ b/gxml/XNode.vala
@@ -193,15 +193,15 @@ public abstract class GXml.XNode : GLib.Object,
        public string? text_content {
          owned get {
            string t = null;
-           if (this is GXml.DomText) return (this as DomText).data;
+           if (this is GXml.DomText) return ((DomText) this).data;
            if (this is GXml.DomProcessingInstruction) return this.@value;
            if (this is GXml.DomComment) return this.@value;
            if (this is GXml.DomDocument || this is GXml.DomElement) {
              message ("Is Element");
              foreach (GXml.DomNode n in children_nodes) {
           if (n is GXml.DomText) {
-            if (t == null) t = (n as XNode).value;
-            else t += (n as XNode).value;
+            if (t == null) t = ((XNode) n).value;
+            else t += ((XNode) n).value;
           }
              }
            }
@@ -246,18 +246,18 @@ public abstract class GXml.XNode : GLib.Object,
     if (node == null) return false;
     if (this.children_nodes.size != node.child_nodes.size) return false;
     foreach (GXml.DomNode a in attrs.values) {
-      if (!(node as GXml.XNode?).attrs.has_key (a.node_name)) return false;
-      if ((a as XNode).value != ((node as GXml.XNode).attrs.get (a.node_name) as XNode).value) return false;
+      if (!((GXml.XNode?) node).attrs.has_key (a.node_name)) return false;
+      if ((a as XNode).value != ((XNode) ((GXml.XNode) node).attrs.get (a.node_name)).value) return false;
     }
     for (int i=0; i < children_nodes.size; i++) {
-      if (!(children_nodes[i] as GXml.DomNode).is_equal_node ((node as GXml.DomNode?).child_nodes[i] as 
GXml.DomNode?)) return false;
+      if (!((GXml.DomNode) children_nodes[i]).is_equal_node (((GXml.DomNode?) node).child_nodes[i])) return 
false;
     }
     return true;
   }
 
   public DomNode.DocumentPosition compare_document_position (DomNode other) {
     if ((this as GXml.DomNode) == other) return DomNode.DocumentPosition.NONE;
-    if (this.document != (other as GXml.DomNode).owner_document || other.parent_node == null) {
+    if (this.document != ((GXml.DomNode) other).owner_document || other.parent_node == null) {
       var p = DomNode.DocumentPosition.DISCONNECTED & DomNode.DocumentPosition.IMPLEMENTATION_SPECIFIC;
       if ((&this) > (&other))
         p = p & DomNode.DocumentPosition.PRECEDING;
@@ -265,7 +265,7 @@ public abstract class GXml.XNode : GLib.Object,
        p = p & DomNode.DocumentPosition.FOLLOWING;
       return p;
     }
-    if ((this as DomNode).contains (other))
+    if (((DomNode) this).contains (other))
       return DomNode.DocumentPosition.CONTAINED_BY & DomNode.DocumentPosition.FOLLOWING;
     if (this.parent_node.contains (other)) {
       var par = this.parent_node;
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index 65d7cd3..09d480b 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -192,10 +192,11 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
       throw new ParserError.INVALID_DATA_ERROR (_("Internal Error: No TextReader was set"));
     move_next_node ();
     if (node is DomElement) {
+      var element_node= (DomElement) node;
       while (true) {
         if (current_is_element ()
             &&
-            (current_node_name ().down () == (node as DomElement).local_name.down ())) {
+            (current_node_name ().down () == element_node.local_name.down ())) {
           break;
         }
         if (!current_is_document ()) {
@@ -203,7 +204,7 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         }
         if (!move_next_node ()) break;
       }
-      read_element (node as DomElement);
+      read_element (element_node);
     }
     if (current_is_element () && (node is DomDocument))
       read_child_element (node);
@@ -212,11 +213,11 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         read_child_nodes (node);
       }
       if (node is GXml.Element) {
-        if ((node as GXml.Element).parse_children)
+        if (((GXml.Element) node).parse_children)
           read_child_nodes (node);
         else {
-          (node as GXml.Element).unparsed = read_unparsed ();
-          //warning ("Unparsed text: "+(node as GXml.Object).unparsed);
+          ((GXml.Element) node).unparsed = read_unparsed ();
+          //warning ("Unparsed text: "+((GXml.Object) node).unparsed);
           move_next_node ();
         }
       }
@@ -464,7 +465,7 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
     tw.set_indent (indent);
     // Root
     if (_node is DomDocument) {
-      if ((node as DomDocument).document_element == null) {
+      if (((DomDocument) node).document_element == null) {
         tw.end_document ();
       }
     }
@@ -484,18 +485,19 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
       throw new ParserError.INVALID_DATA_ERROR (_("Internal Error: No TextWriter initialized"));
     int size = 0;
     if (node is GXml.DomElement) {
-      if ((node as DomElement).namespace_uri != null) {
-          string lpns = (node.parent_node).lookup_prefix ((node as DomElement).namespace_uri);
-          if (lpns == (node as DomElement).prefix
-              && (node as DomElement).prefix != null) {
+      var element_node = (DomElement) node;
+      if (element_node.namespace_uri != null) {
+          string lpns = (node.parent_node).lookup_prefix (element_node.namespace_uri);
+          if (lpns == element_node.prefix
+              && element_node.prefix != null) {
             tw.start_element (node.node_name);
           }
           else
-            tw.start_element_ns ((node as DomElement).prefix,
-                                 (node as DomElement).local_name,
-                                 (node as DomElement).namespace_uri);
+            tw.start_element_ns (element_node.prefix,
+                                 element_node.local_name,
+                                 element_node.namespace_uri);
       } else
-        tw.start_element ((node as DomElement).local_name);
+        tw.start_element (element_node.local_name);
 
     // GXml.Object serialization
     var lp = (node as GXml.Object).get_properties_list ();
@@ -518,9 +520,9 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         tw.flush ();
     }
     // DomElement attributes
-    var keys = (node as DomElement).attributes.keys;
+    var keys = element_node.attributes.keys;
     foreach (string ak in keys) {
-      var prop = (node as DomElement).attributes.get (ak) as GXml.Attr;
+      var prop = element_node.attributes.get (ak) as GXml.Attr;
       if (prop == null) {
         continue;
       }
@@ -532,12 +534,12 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         continue;
       }
       if ("xmlns:" in ak) {
-        string ns = (node as DomElement).namespace_uri;
+        string ns = element_node.namespace_uri;
         if (ns != null) {
           string[] strs = ak.split (":");
           if (strs.length == 2) {
             string nsp = strs[1];
-            if (ns == v && nsp == (node as DomElement).prefix) {
+            if (ns == v && nsp == element_node.prefix) {
               continue;
             }
           }
@@ -563,7 +565,7 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
     tw.set_indent (indent);
     // Root
     if (_node is DomDocument) {
-      if ((node as DomDocument).document_element == null) {
+      if (((DomDocument) node).document_element == null) {
         tw.end_document ();
       }
     }
@@ -589,22 +591,23 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
       throw new ParserError.INVALID_DATA_ERROR (_("Internal Error: No TextWriter initialized"));
     int size = 0;
     if (node is GXml.DomElement) {
-      if ((node as DomElement).namespace_uri != null) {
-          string lpns = (node.parent_node).lookup_prefix ((node as DomElement).namespace_uri);
-          if (lpns == (node as DomElement).prefix
-              && (node as DomElement).prefix != null) {
+      var element_node = (GXml.DomElement) node;
+      if (element_node.namespace_uri != null) {
+          string lpns = (node.parent_node).lookup_prefix (element_node.namespace_uri);
+          if (lpns == element_node.prefix
+              && element_node.prefix != null) {
             tw.start_element (node.node_name);
           }
           else
-            tw.start_element_ns ((node as DomElement).prefix,
-                                 (node as DomElement).local_name,
-                                 (node as DomElement).namespace_uri);
+            tw.start_element_ns (element_node.prefix,
+                                 element_node.local_name,
+                                 element_node.namespace_uri);
       } else
-        tw.start_element ((node as DomElement).local_name);
+        tw.start_element (element_node.local_name);
     Idle.add (start_node_async.callback);
     yield;
     // GXml.Object serialization
-    var lp = (node as GXml.Object).get_properties_list ();
+    var lp = ((GXml.Object) node).get_properties_list ();
     foreach (ParamSpec pspec in lp) {
       Idle.add (start_node_async.callback);
       yield;
@@ -617,7 +620,7 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         if (gp == null) continue;
         val = gp.value;
       } else {
-        val = (node as GXml.Object).get_property_string (pspec);
+        val = ((GXml.Object) node).get_property_string (pspec);
       }
       if (val == null) continue;
       size += tw.write_attribute (attname, val);
@@ -626,17 +629,17 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         tw.flush ();
     }
     // DomElement attributes
-    foreach (string ak in (node as DomElement).attributes.keys) {
+    foreach (string ak in element_node.attributes.keys) {
       Idle.add (start_node_async.callback);
       yield;
-      string v = ((node as DomElement).attributes as Gee.HashMap<string,string>).get (ak);
+      string v = ((Gee.HashMap<string,string>) element_node.attributes).get (ak);
       if ("xmlns:" in ak) {
-        string ns = (node as DomElement).namespace_uri;
+        string ns = element_node.namespace_uri;
         if (ns != null) {
           string[] strs = ak.split (":");
           if (strs.length == 2) {
             string nsp = strs[1];
-            if (ns == v && nsp == (node as DomElement).prefix) {
+            if (ns == v && nsp == element_node.prefix) {
               continue;
             }
           }
@@ -676,15 +679,15 @@ public class GXml.XParser : GLib.Object, GXml.Parser {
         tw.flush ();
     }
     if (n is GXml.DomProcessingInstruction) {
-      size += tw.write_pi ((n as DomProcessingInstruction).target,
-                          (n as DomProcessingInstruction).data);
+      size += tw.write_pi (((DomProcessingInstruction) n).target,
+                          ((DomProcessingInstruction) n).data);
       if (size > 1500)
         tw.flush ();
     }
     if (n is GXml.DomDocumentType) {
-      size += tw.write_dtd ((n as DomDocumentType).name,
-                          (n as DomDocumentType).public_id,
-                          (n as DomDocumentType).system_id,
+      size += tw.write_dtd (((DomDocumentType) n).name,
+                          ((DomDocumentType) n).public_id,
+                          ((DomDocumentType) n).system_id,
                           null);
       if (size > 1500)
         tw.flush ();
diff --git a/gxml/XsdSchema.vala b/gxml/XsdSchema.vala
index ae46766..9acca31 100644
--- a/gxml/XsdSchema.vala
+++ b/gxml/XsdSchema.vala
@@ -258,7 +258,7 @@ public class GXml.XsdAttributeGroup : XsdBaseAttribute {}
 
 public class GXml.XsdList : ArrayList {
   public new int length {
-    get { return (this as ArrayList).length; }
+    get { return ((ArrayList) this).length; }
   }
   public void remove (int index) {
     try { element.remove_child (element.child_nodes.item (index)); }
diff --git a/test/CssSelectorTest.vala b/test/CssSelectorTest.vala
index 6994941..2b7fbbb 100644
--- a/test/CssSelectorTest.vala
+++ b/test/CssSelectorTest.vala
@@ -539,12 +539,12 @@ class CssSelectorTest : GXmlTest {
                                c3.append_child (c5);
                                var c6 = d.create_element ("second");
                                c4.append_child (c6);
-                               assert (c1 == (c1.parent_node as DomParentNode).first_element_child);
-                               assert (c2 != (c2.parent_node as DomParentNode).first_element_child);
-                               assert (c3 != (c3.parent_node as DomParentNode).first_element_child);
-                               assert (c4 != (c4.parent_node as DomParentNode).first_element_child);
-                               assert (c5 == (c5.parent_node as DomParentNode).first_element_child);
-                               assert (c6 == (c6.parent_node as DomParentNode).first_element_child);
+                               assert (c1 == ((DomParentNode) c1.parent_node).first_element_child);
+                               assert (c2 != ((DomParentNode) c2.parent_node).first_element_child);
+                               assert (c3 != ((DomParentNode) c3.parent_node).first_element_child);
+                               assert (c4 != ((DomParentNode) c4.parent_node).first_element_child);
+                               assert (c5 == ((DomParentNode) c5.parent_node).first_element_child);
+                               assert (c6 == ((DomParentNode) c6.parent_node).first_element_child);
                                assert (!cp.match (r));
                                assert (!cp.match (c1));
                                assert (!cp.match (c2));
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index bf4eddd..605cd55 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -300,7 +300,7 @@ class GXml.DocumentTest : GXmlTest {
                                try {
                                        doc = new GXml.Document.from_string ("<document_element />");
                                        var f = GLib.File.new_for_path 
(GXmlTestConfig.TEST_SAVE_DIR+"/test_out_path.xml");
-                                       (doc as GXml.Document).write_file (f);
+                                       ((GXml.Document) doc).write_file (f);
                                        assert (f.query_exists ());
                                        f.delete ();
                                } catch (GLib.Error e) {
@@ -313,7 +313,7 @@ class GXml.DocumentTest : GXmlTest {
 
                                try {
                                        doc = new GXml.Document.from_string ("<document_element />");
-                                       (doc as GXml.Document).write_file (GLib.File.new_for_path 
("/tmp/a/b/c/d/e/f/g/h/i"));
+                                       ((GXml.Document) doc).write_file (GLib.File.new_for_path 
("/tmp/a/b/c/d/e/f/g/h/i"));
                                        assert_not_reached ();
                                } catch {}
                        });
@@ -465,11 +465,11 @@ class GXml.DocumentTest : GXmlTest {
                                assert (c.prefix == null);
                                assert (c.namespace_uri == null);
                                c.set_attribute_ns ("http://www.gnome.org/GXml2","gxml2:prop","val";);
-                               var p = (c as DomElement)
+                               var p = ((DomElement) c)
                                                                        .get_attribute_ns 
("http://www.gnome.org/GXml2";, "prop");
                                assert (p != null);
                                assert (p == "val");
-                               message ((doc as GXml.Document).write_string ());
+                               message (((GXml.Document) doc).write_string ());
                                assert (doc.document_element.lookup_namespace_uri (null) == 
"http://www.gnome.org/GXml";);
                                assert (c.prefix == null);
                                assert (c.namespace_uri == null);
@@ -555,7 +555,7 @@ class GXml.DocumentTest : GXmlTest {
                        try {
                                c.set_attribute_ns ("http://www.gnome.org/GXml3","gxml2:prop","val";);
                        } catch {}
-                               var p = (c as DomElement).get_attribute_ns ("http://www.gnome.org/GXml4";, 
"prop");
+                               var p = ((DomElement) c).get_attribute_ns ("http://www.gnome.org/GXml4";, 
"prop");
                                assert (p == null);
                });
                Test.add_func ("/gxml/gom-document/parent", () => {
@@ -748,7 +748,7 @@ class GXml.DocumentTest : GXmlTest {
                        try {
                                var d = new GXml.Document.from_string ("""<root><child id="id1"/><child 
id="id2"/></root>""") as DomDocument;
                                message ("Serialize Document");
-                               message ((d as GXml.Document).write_string ());
+                               message (((GXml.Document) d).write_string ());
                                var e = d.get_element_by_id ("id1");
                                assert (e != null);
                        } catch (GLib.Error e) {
diff --git a/test/DomXDocumentTest.vala b/test/DomXDocumentTest.vala
index 6748a19..a1a3014 100644
--- a/test/DomXDocumentTest.vala
+++ b/test/DomXDocumentTest.vala
@@ -175,7 +175,7 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
                        var e = doc.document_element.children[0].children[1];
                        assert (e.node_name == "p");
                        assert (e is DomElement);
-                       assert ((e as DomElement).get_attribute ("id") == "p01");
+                       assert (((DomElement) e).get_attribute ("id") == "p01");
                        assert (e.owner_document == (DomDocument) doc);
                        assert (e.parent_node != null);
                        assert (e.parent_node.node_name == "body");
@@ -199,12 +199,12 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
                        assert (e.parent_node.has_child_nodes ());
                        e.parent_node.normalize ();
                        assert (e.parent_node.text_content == null);
-                       var cn = (e as XElement).clone_node (false) as DomElement;
+                       var cn = ((XElement) e).clone_node (false) as DomElement;
                        assert (cn.node_name == "p");
                        assert (cn.get_attribute ("id") == "p01");
                        assert (cn.child_nodes != null);
                        assert (cn.child_nodes.size == 0);
-                       var cn2 = (e as XElement).clone_node (true) as DomElement;
+                       var cn2 = ((XElement) e).clone_node (true) as DomElement;
                        assert (cn2.node_name == "p");
                        assert (cn2.get_attribute ("id") == "p01");
                        assert (cn2.child_nodes != null);
@@ -366,8 +366,8 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
                        assert (n.attributes.get_named_item ("id").node_name == "id");
                        assert (n.attributes.get_named_item ("id").node_value == "0y1");
                        assert (n.node_name == "code");
-                       assert ((n as DomNode).lookup_namespace_uri ("gxml") == "http://live.gnome.org/GXml";);
-                       assert ((n as DomNode).lookup_prefix ("http://live.gnome.org/GXml";) == "gxml");
+                       assert (((DomNode) n).lookup_namespace_uri ("gxml") == "http://live.gnome.org/GXml";);
+                       assert (((DomNode) n).lookup_prefix ("http://live.gnome.org/GXml";) == "gxml");
                        assert (n.tag_name == "gxml:code");
                        n.remove_attribute ("id");
                        assert (n.get_attribute ("id") == null);
@@ -573,9 +573,9 @@ const string XMLDOC ="<?xml version=\"1.0\"?>
                                GLib.message ("NTST: "+(ntst as GXml.Node).to_string ());
 #endif
                                assert (ntst.child_nodes.item (0) is DomText);
-                               assert ((ntst.child_nodes.item (0) as DomText).data == "TEXT1TEXT2");
+                               assert (((DomText) ntst.child_nodes.item (0)).data == "TEXT1TEXT2");
                                // BUG: DomText.whole_text
-                               assert ((ntst.child_nodes.item(0) as DomText).whole_text == "TEXT1TEXT2");
+                               assert (((DomText) ntst.child_nodes.item(0)).whole_text == "TEXT1TEXT2");
                        } catch (GLib.Error e) {
                                GLib.message ("Error: "+ e.message);
                                assert_not_reached ();
diff --git a/test/ElementTest.vala b/test/ElementTest.vala
index 8eda239..81feba8 100644
--- a/test/ElementTest.vala
+++ b/test/ElementTest.vala
@@ -227,19 +227,19 @@ class GXml.ElementTest : GXmlTest  {
                                GXml.Node node = (GXml.Node) root.child_nodes[0];
                                assert (node != null);
                                assert (node is DomElement);
-                               assert ((node as DomElement).local_name == "Potion");
+                               assert (((DomElement) node).local_name == "Potion");
                                assert (node.node_name == "magic:Potion");
-                               assert ((node as DomElement).namespace_uri == "http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).prefix == "magic");
-                               assert ((node as DomElement).attributes.size == 2);
-                               GLib.message ("Attributes: "+(node as DomElement).attributes.size.to_string 
());
-                               assert ((node as DomElement).get_attribute ("xmlns:magic") == 
"http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).get_attribute_ns 
("http://www.w3.org/2000/xmlns/";, "magic") == "http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).get_attribute ("xmlns:products") == 
"http://diagonalley.co.uk/products";);
-                               assert ((node as DomElement).get_attribute_ns 
("http://www.w3.org/2000/xmlns/","products";) == "http://diagonalley.co.uk/products";);
+                               assert (((DomElement) node).namespace_uri == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).prefix == "magic");
+                               assert (((DomElement) node).attributes.size == 2);
+                               GLib.message ("Attributes: "+((DomElement) node).attributes.size.to_string 
());
+                               assert (((DomElement) node).get_attribute ("xmlns:magic") == 
"http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).get_attribute_ns 
("http://www.w3.org/2000/xmlns/";, "magic") == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).get_attribute ("xmlns:products") == 
"http://diagonalley.co.uk/products";);
+                               assert (((DomElement) node).get_attribute_ns 
("http://www.w3.org/2000/xmlns/","products";) == "http://diagonalley.co.uk/products";);
                                assert (node.lookup_prefix ("http://diagonalley.co.uk/products";) == 
"products");
                                assert (node.lookup_namespace_uri ("products") == 
"http://diagonalley.co.uk/products";);
-                               (node as DomElement).set_attribute_ns ("http://www.w3.org/2000/xmlns";, 
"xmlns:gxmlt","http://org.gnome.org/GXmlTest/";);
+                               ((DomElement) node).set_attribute_ns ("http://www.w3.org/2000/xmlns";, 
"xmlns:gxmlt","http://org.gnome.org/GXmlTest/";);
                        } catch (GLib.Error e) {
                                GLib.message (e.message);
                                assert_not_reached ();
@@ -254,25 +254,25 @@ class GXml.ElementTest : GXmlTest  {
                                GXml.Node node = (GXml.Node) root.child_nodes[0];
                                assert (node != null);
                                assert (node is DomElement);
-                               assert ((node as DomElement).local_name == "Potion");
+                               assert (((DomElement) node).local_name == "Potion");
                                assert (node.node_name == "magic:Potion");
-                               assert ((node as DomElement).namespace_uri == "http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).prefix == "magic");
+                               assert (((DomElement) node).namespace_uri == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).prefix == "magic");
 #if DEBUG
-                               message ("Element: "+(node as GXml.Element).write_string ());
-                               message ("Attributes: "+(node as DomElement).attributes.length.to_string ());
-                               foreach (string k in (node as DomElement).attributes.keys) {
-                                       string v = (node as DomElement).get_attribute (k);
+                               message ("Element: "+((DomElement) node).write_string ());
+                               message ("Attributes: "+((DomElement) node).attributes.length.to_string ());
+                               foreach (string k in ((DomElement) node).attributes.keys) {
+                                       string v = ((DomElement) node).get_attribute (k);
                                        if (v == null) v = "NULL";
                                        GLib.message ("Attribute: "+k+"="+v);
                                }
 #endif
                                message ((node as GXml.Element).write_string ());
-                               assert ((node as DomElement).attributes.length == 2);
-                               assert ((node as DomElement).get_attribute ("xmlns:magic") == 
"http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).get_attribute_ns 
("http://www.w3.org/2000/xmlns/";, "magic") == "http://hogwarts.co.uk/magic";);
-                               assert ((node as DomElement).get_attribute ("xmlns:products") == 
"http://diagonalley.co.uk/products";);
-                               assert ((node as DomElement).get_attribute_ns 
("http://www.w3.org/2000/xmlns/","products";) == "http://diagonalley.co.uk/products";);
+                               assert (((DomElement) node).attributes.length == 2);
+                               assert (((DomElement) node).get_attribute ("xmlns:magic") == 
"http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).get_attribute_ns 
("http://www.w3.org/2000/xmlns/";, "magic") == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) node).get_attribute ("xmlns:products") == 
"http://diagonalley.co.uk/products";);
+                               assert (((DomElement) node).get_attribute_ns 
("http://www.w3.org/2000/xmlns/","products";) == "http://diagonalley.co.uk/products";);
                                assert (node.lookup_prefix ("http://diagonalley.co.uk/products";) == 
"products");
                                assert (node.lookup_namespace_uri ("products") == 
"http://diagonalley.co.uk/products";);
                        } catch (GLib.Error e) {
@@ -292,15 +292,15 @@ class GXml.ElementTest : GXmlTest  {
                                var n1 = r.child_nodes.item (0);
                                assert (n1 != null);
                                assert (n1 is DomElement);
-                               assert ((n1 as DomElement).local_name == "Arc");
-                               assert ((n1 as DomElement).prefix == "magic");
-                               assert ((n1 as DomElement).namespace_uri == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) n1).local_name == "Arc");
+                               assert (((DomElement) n1).prefix == "magic");
+                               assert (((DomElement) n1).namespace_uri == "http://hogwarts.co.uk/magic";);
                                var n2 = r.child_nodes.item (1);
                                assert (n2 != null);
                                assert (n2 is DomElement);
-                               assert ((n2 as DomElement).local_name == "Diamond");
-                               assert ((n2 as DomElement).prefix == "products");
-                               assert ((n2 as DomElement).namespace_uri == "http://hogwarts.co.uk/magic";);
+                               assert (((DomElement) n2).local_name == "Diamond");
+                               assert (((DomElement) n2).prefix == "products");
+                               assert (((DomElement) n2).namespace_uri == "http://hogwarts.co.uk/magic";);
                        } catch (GLib.Error e) {
                                GLib.warning (e.message);
                        }
@@ -507,7 +507,7 @@ class GXml.ElementTest : GXmlTest  {
                                assert (doc.document_element.parent_node is GXml.DomDocument);
                                assert (doc.document_element.child_nodes.length == 1);
                                assert (doc.document_element.child_nodes[0] is DomChildNode);
-                               (doc.document_element.child_nodes[0] as DomChildNode).remove ();
+                               ((DomChildNode) doc.document_element.child_nodes[0]).remove ();
                                assert (doc.document_element.child_nodes.length == 0);
                                assert ("<root/>" in  doc.write_string ());
                  } catch (GLib.Error e) {
@@ -594,9 +594,9 @@ class GXml.ElementTest : GXmlTest  {
                                assert (doc.document_element.child_nodes[1] != null);
                                assert (doc.document_element.child_nodes[1] is DomElement);
                                assert (doc.document_element.child_nodes[1].node_name == "child");
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling != null);
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling is DomElement);
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling.node_name == "child");
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling != null);
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling is DomElement);
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling.node_name == "child");
                                assert (doc.document_element.child_nodes[2] != null);
                                assert (doc.document_element.child_nodes[2].parent_node != null);
                                assert (doc.document_element.child_nodes[2].parent_node.node_name == "root");
@@ -604,9 +604,9 @@ class GXml.ElementTest : GXmlTest  {
                                assert (doc.document_element.child_nodes[3] != null);
                                assert (doc.document_element.child_nodes[3] is DomElement);
                                assert (doc.document_element.child_nodes[3].node_name == "child");
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling != null);
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling is DomElement);
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling.node_name == "child");
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling != null);
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling is DomElement);
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling.node_name == "child");
                                } catch (GLib.Error e) {
                                        Test.message (e.message);
                                        assert_not_reached ();
@@ -783,37 +783,37 @@ class GXml.ElementTest : GXmlTest  {
                                        var a = e.attributes.get (k) as DomAttr;
                                        message ("Attr: %s:%s", a.name, a.@value);
                                }
-                               assert ((e.attributes.item (0) as DomAttr).@value == "value1");
-                               assert ((e.attributes.item (1) as DomAttr).@value == "value_prop");
+                               assert (((DomAttr) e.attributes.item (0)).@value == "value1");
+                               assert (((DomAttr) e.attributes.item (1)).@value == "value_prop");
                                e.set_attribute ("p1", "prop1");
                                e.set_attribute ("p2", "prop2");
                                e.set_attribute ("p3", "prop3");
                                assert (e.attributes.length == 5);
-                               assert ((e.attributes.item (0) as DomAttr).@value == "value1");
-                               assert ((e.attributes.item (1) as DomAttr).@value == "value_prop");
-                               assert ((e.attributes.item (2) as DomAttr).@value == "prop1");
-                               assert ((e.attributes.item (3) as DomAttr).@value == "prop2");
-                               assert ((e.attributes.item (4) as DomAttr).@value == "prop3");
+                               assert (((DomAttr) e.attributes.item (0)).@value == "value1");
+                               assert (((DomAttr) e.attributes.item (1)).@value == "value_prop");
+                               assert (((DomAttr) e.attributes.item (2)).@value == "prop1");
+                               assert (((DomAttr) e.attributes.item (3)).@value == "prop2");
+                               assert (((DomAttr) e.attributes.item (4)).@value == "prop3");
                                e.set_attribute_ns ("http://www.w3.org/2000/xmlns/";, "xmlns:t", 
"http://www.gnome.org/gxml/test";);
                                e.set_attribute_ns ("http://www.gnome.org/gxml/test";, "t:p1", "prop1_test");
                                e.set_attribute_ns ("http://www.gnome.org/gxml/test";, "t:p2", "prop2_test");
                                assert (e.get_attribute_ns ("http://www.gnome.org/gxml/test";, "p1") == 
"prop1_test");
                                assert (e.get_attribute_ns ("http://www.gnome.org/gxml/test";, "p2") == 
"prop2_test");
                                assert (e.attributes.length == 8);
-                               assert ((e.attributes.item (0) as DomAttr).@value == "value1");
-                               assert ((e.attributes.item (1) as DomAttr).@value == "value_prop");
-                               assert ((e.attributes.item (2) as DomAttr).@value == "prop1");
-                               assert ((e.attributes.item (3) as DomAttr).@value == "prop2");
-                               assert ((e.attributes.item (4) as DomAttr).@value == "prop3");
-                               assert ((e.attributes.item (5) as DomAttr).@value == 
"http://www.gnome.org/gxml/test";);
-                               assert ((e.attributes.item (6) as DomAttr).@value == "prop1_test");
-                               assert ((e.attributes.item (7) as DomAttr).@value == "prop2_test");
+                               assert (((DomAttr) e.attributes.item (0)).@value == "value1");
+                               assert (((DomAttr) e.attributes.item (1)).@value == "value_prop");
+                               assert (((DomAttr) e.attributes.item (2)).@value == "prop1");
+                               assert (((DomAttr) e.attributes.item (3)).@value == "prop2");
+                               assert (((DomAttr) e.attributes.item (4)).@value == "prop3");
+                               assert (((DomAttr) e.attributes.item (5)).@value == 
"http://www.gnome.org/gxml/test";);
+                               assert (((DomAttr) e.attributes.item (6)).@value == "prop1_test");
+                               assert (((DomAttr) e.attributes.item (7)).@value == "prop2_test");
                                e.id = "di1";
                                assert (e.id == "di1");
                                assert (e.get_attribute ("id") == "di1");
                                assert (e.attributes.length == 9);
                                assert (e.attributes.item (8) != null);
-                               assert ((e.attributes.item (8) as DomAttr).@value == "di1");
+                               assert (((DomAttr) e.attributes.item (8)).@value == "di1");
                                e.child = GLib.Object.new (typeof (ObjectParent.ObjectChild),
                                                                                                              
          "owner-document", e.owner_document) as ObjectParent.ObjectChild;
                                e.append_child (e.child);
@@ -842,31 +842,31 @@ class GXml.ElementTest : GXmlTest  {
                                e.set_attribute ("id", "id2");
                                assert (e.get_attribute ("id") == "id2");
                                assert (e.id == "id2");
-                               assert ((e.attributes.item (0) as DomAttr).value == "id2");
+                               assert (((DomAttr) e.attributes.item (0)).value == "id2");
                                e.set_attribute ("prop", "val_prop");
                                assert (e.prop != null);
                                assert (e.prop is ObjectParent.ObjectProperty);
                                assert (e.prop.value == "val_prop");
                                assert (e.get_attribute ("prop") == "val_prop");
-                               assert ((e.attributes.item (1) as DomAttr).value == "val_prop");
+                               assert (((DomAttr) e.attributes.item (1)).value == "val_prop");
                                e.set_attribute ("prop1", "val_prop1");
                                assert (e.prop1 != null);
                                assert (e.prop1 is ObjectParent.ObjectProperty);
                                assert (e.prop1.value == "val_prop1");
                                assert (e.get_attribute ("prop1") == "val_prop1");
-                               assert ((e.attributes.item (2) as DomAttr).value == "val_prop1");
+                               assert (((DomAttr) e.attributes.item (2)).value == "val_prop1");
                                e.set_attribute ("prop2", "val_prop2");
                                assert (e.prop2 != null);
                                assert (e.prop2 is ObjectParent.ObjectProperty);
                                assert (e.prop2.value == "val_prop2");
                                assert (e.get_attribute ("prop2") == "val_prop2");
-                               assert ((e.attributes.item (3) as DomAttr).value == "val_prop2");
+                               assert (((DomAttr) e.attributes.item (3)).value == "val_prop2");
                                e.set_attribute ("prop3", "val_prop3");
                                assert (e.prop3 != null);
                                assert (e.prop3 is ObjectParent.ObjectProperty);
                                assert (e.prop3.value == "val_prop3");
                                assert (e.get_attribute ("prop3") == "val_prop3");
-                               assert ((e.attributes.item (4) as DomAttr).value == "val_prop3");
+                               assert (((DomAttr) e.attributes.item (4)).value == "val_prop3");
                        } catch (GLib.Error e) {
                    GLib.message ("Error: "+e.message);
                    assert_not_reached ();
diff --git a/test/SerializationTest.vala b/test/SerializationTest.vala
index ebef3eb..ad11df4 100644
--- a/test/SerializationTest.vala
+++ b/test/SerializationTest.vala
@@ -744,9 +744,9 @@ class SerializationTest : GXmlTest  {
       GLib.message ("DOC:"+s);
 #endif
       assert ("<BookStand Classification=\"Science\"><BookRegister Year=\"2016\"/><BookRegister 
Year=\"2010\"/><Test/><BookRegister Year=\"2000\"/></BookStand>" in s);
-      assert ((bs.registers.get_item (0) as BookRegister).year == 2016);
-      assert ((bs.registers.get_item (1) as BookRegister).year == 2010);
-      assert ((bs.registers.get_item (2) as BookRegister).year == 2000);
+      assert (((BookRegister) bs.registers.get_item (0)).year == 2016);
+      assert (((BookRegister) bs.registers.get_item (1)).year == 2010);
+      assert (((BookRegister) bs.registers.get_item (2)).year == 2000);
       assert (bs.set_instance_property("Dimension-X"));
       assert (bs.dimension_x != null);
       assert (bs.dimension_x.length == 1.0);
@@ -826,9 +826,9 @@ class SerializationTest : GXmlTest  {
       assert (bs.books.get("Title1") != null);
       assert (bs.books.get("Title2") != null);
       assert (bs.books.get("Title3") != null);
-      assert ((bs.books.get("Title1") as Book).name == "Title1");
-      assert ((bs.books.get("Title2") as Book).name == "Title2");
-      assert ((bs.books.get("Title3") as Book).name == "Title3");
+      assert (((Book) bs.books.get("Title1")).name == "Title1");
+      assert (((Book) bs.books.get("Title2")).name == "Title2");
+      assert (((Book) bs.books.get("Title3")).name == "Title3");
     } catch (GLib.Error e) {
       GLib.message ("Error: "+e.message);
       assert_not_reached ();
@@ -1137,9 +1137,9 @@ class SerializationTest : GXmlTest  {
       assert (bs.registers.get_item (2) != null);
       assert (bs.registers.get_item (2) is DomElement);
       assert (bs.registers.get_item (2) is BookRegister);
-      assert ((bs.registers.get_item (0) as BookRegister).year == 2016);
-      assert ((bs.registers.get_item (1) as BookRegister).year == 2010);
-      assert ((bs.registers.get_item (2) as BookRegister).year == 2000);
+      assert (((BookRegister) bs.registers.get_item (0)).year == 2016);
+      assert (((BookRegister) bs.registers.get_item (1)).year == 2010);
+      assert (((BookRegister) bs.registers.get_item (2)).year == 2000);
     } catch (GLib.Error e) {
       GLib.message ("Error: "+e.message);
       assert_not_reached ();
@@ -1172,9 +1172,9 @@ class SerializationTest : GXmlTest  {
       assert (bs.books.get_item (2) != null);
       assert (bs.books.get_item (2) is DomElement);
       assert (bs.books.get_item (2) is Book);
-      assert ((bs.books.get_item (0) as Book).name == "Title1");
-      assert ((bs.books.get_item (1) as Book).name == "Title2");
-      assert ((bs.books.get_item (2) as Book).name == "Title3");
+      assert (((Book) bs.books.get_item (0)).name == "Title1");
+      assert (((Book) bs.books.get_item (1)).name == "Title2");
+      assert (((Book) bs.books.get_item (2)).name == "Title3");
       assert (bs.books.get ("Title1") != null);
       assert (bs.books.get ("Title1") is DomElement);
       assert (bs.books.get ("Title1") is Book);
@@ -1415,8 +1415,8 @@ class SerializationTest : GXmlTest  {
       message (bs.write_string ());
       n = 1;
       foreach (DomElement e in bs.books) {
-        assert ((e as Book) != null);
-        assert ((e as Book).name == "Title %d".printf (n));
+        assert (((Book) e) != null);
+        assert (((Book) e).name == "Title %d".printf (n));
         n++;
       }
       var bst = new BookStand ();
@@ -1433,8 +1433,8 @@ class SerializationTest : GXmlTest  {
       }
       n = 1;
       foreach (DomElement e in r) {
-        assert ((e as BookRegister) != null);
-        assert ((e as BookRegister).year == 2000 + n);
+        assert (((BookRegister) e) != null);
+        assert (((BookRegister) e).year == 2000 + n);
         n++;
       }
       bst.set_instance_property ("hashmap-registers");
@@ -1451,8 +1451,8 @@ class SerializationTest : GXmlTest  {
       }
       n = 1;
       foreach (DomElement e in hr) {
-        assert ((e as BookRegister) != null);
-        assert ((e as BookRegister).year == 2000 + n);
+        assert (((BookRegister) e) != null);
+        assert (((BookRegister) e).year == 2000 + n);
         n++;
       }
 
@@ -1470,9 +1470,9 @@ class SerializationTest : GXmlTest  {
       }
       n = 1;
       foreach (DomElement e in hpr) {
-        assert ((e as BookRegister) != null);
-        assert ((e as BookRegister).book.name == "book%d".printf (n));
-        assert ((e as BookRegister).year ==  2000 + n);
+        assert (((BookRegister) e) != null);
+        assert (((BookRegister) e).book.name == "book%d".printf (n));
+        assert (((BookRegister) e).year ==  2000 + n);
         n++;
       }
 
@@ -1491,10 +1491,10 @@ class SerializationTest : GXmlTest  {
       }
       n = 1;
       foreach (DomElement e in htr) {
-        assert ((e as BookRegister) != null);
-        assert ((e as BookRegister).book.name == "book%d".printf (n));
-        assert ((e as BookRegister).year == 2000 + n);
-        assert ((e as BookRegister).cover == "cover%d".printf (n));
+        assert (((BookRegister) e) != null);
+        assert (((BookRegister) e).book.name == "book%d".printf (n));
+        assert (((BookRegister) e).year == 2000 + n);
+        assert (((BookRegister) e).cover == "cover%d".printf (n));
         n++;
       }
     } catch (GLib.Error e) {
diff --git a/test/StreamReaderPerformanceAsyncReadUnparsedTest.vala 
b/test/StreamReaderPerformanceAsyncReadUnparsedTest.vala
index b06cf7a..32d8a4b 100644
--- a/test/StreamReaderPerformanceAsyncReadUnparsedTest.vala
+++ b/test/StreamReaderPerformanceAsyncReadUnparsedTest.vala
@@ -40,9 +40,9 @@ class GXmlTest.Suite : GLib.Object
         message ("Initial Parse: %g sec for %d nodes", Test.timer_elapsed (), 
d.document_element.child_nodes.length);
         Test.timer_start ();
         Idle.add (()=>{
-          (d.document_element as GXml.Element).parse_buffer_async.begin ((obj, res)=>{
+          ((GXml.Element) d.document_element).parse_buffer_async.begin ((obj, res)=>{
             try {
-              (d.document_element as GXml.Element).parse_buffer_async.end (res);
+              ((GXml.Element) d.document_element).parse_buffer_async.end (res);
             } catch (GLib.Error e) {
               warning ("Error: %s", e.message);
             }
@@ -50,10 +50,10 @@ class GXmlTest.Suite : GLib.Object
           if (d.document_element.child_nodes.item (10079).child_nodes.length == 0) {
             return Source.CONTINUE;
           }
-          if ((d.document_element as GXml.Element).parse_pending () != 0) {
+          if (((GXml.Element) d.document_element).parse_pending () != 0) {
             return Source.CONTINUE;
           }
-          message ("Pending to parse: %u", (d.document_element as GXml.Element).parse_pending ());
+          message ("Pending to parse: %u", ((GXml.Element) d.document_element).parse_pending ());
           message ("Parsed buffers: %g sec", Test.timer_elapsed ());
           assert (d.document_element.child_nodes.item (10079) is GXml.Element);
           assert (d.document_element.child_nodes.item (10079).child_nodes.length != 0);
diff --git a/test/StreamReaderPerformanceIterateReadUnparsedTest.vala 
b/test/StreamReaderPerformanceIterateReadUnparsedTest.vala
index 1613991..f1fb74b 100644
--- a/test/StreamReaderPerformanceIterateReadUnparsedTest.vala
+++ b/test/StreamReaderPerformanceIterateReadUnparsedTest.vala
@@ -42,7 +42,7 @@ class GXmlTest.Suite : GLib.Object
         message ("Initial Parse: %lu ms for %d nodes", time / 1000, d.document_element.child_nodes.length);
         Idle.add (()=>{
           try {
-            (d.document_element as GXml.Element).parse_buffer ();
+            ((GXml.Element) d.document_element).parse_buffer ();
             timer.elapsed (out time);
             message ("Parse root: %lu ms", time / 1000);
             loop.quit ();
diff --git a/test/StreamReaderTest.vala b/test/StreamReaderTest.vala
index cdd9513..2005799 100644
--- a/test/StreamReaderTest.vala
+++ b/test/StreamReaderTest.vala
@@ -142,9 +142,9 @@ class GXmlTest {
                        try {
                                var doc = sr.read ();
                                message (doc.write_string ());
-                               var rootbuf = (string) (doc.document_element as 
GXml.Element).read_buffer.data;
+                               var rootbuf = (string) ((GXml.Element) doc.document_element).read_buffer.data;
                                assert (doc.document_element.child_nodes.length > 0);
-                               var childbuf = (string) (doc.document_element.child_nodes.item (0) as 
GXml.Element).read_buffer.data;
+                               var childbuf = (string) ((GXml.Element) doc.document_element.child_nodes.item 
(0)).read_buffer.data;
                                message (rootbuf);
                                message (childbuf);
                                assert (rootbuf == """<root p1="a" p2="b" ></root>""");
@@ -160,8 +160,8 @@ class GXmlTest {
                        try {
                                var doc = sr.read ();
                                message (doc.write_string ());
-                               var rootbuf = (string) (doc.document_element as 
GXml.Element).read_buffer.data;
-                               var childbuf = (string) (doc.document_element.child_nodes.item (0) as 
GXml.Element).read_buffer.data;
+                               var rootbuf = (string) ((GXml.Element) doc.document_element).read_buffer.data;
+                               var childbuf = (string) ((GXml.Element) doc.document_element.child_nodes.item 
(0)).read_buffer.data;
                                message (rootbuf);
                                message (childbuf);
                                assert (rootbuf == """<root p1="a" p2="b" ></root>""");
@@ -177,8 +177,8 @@ class GXmlTest {
                        try {
                                var doc = sr.read ();
                                message (doc.write_string ());
-                               var rootbuf = (string) (doc.document_element as 
GXml.Element).read_buffer.data;
-                               var childbuf = (string) (doc.document_element.child_nodes.item (0) as 
GXml.Element).read_buffer.data;
+                               var rootbuf = (string) ((GXml.Element) doc.document_element).read_buffer.data;
+                               var childbuf = (string) ((GXml.Element) doc.document_element.child_nodes.item 
(0)).read_buffer.data;
                                message (rootbuf);
                                message (childbuf);
                                assert (rootbuf == """<root p1="a" p2="b" ></root>""");
@@ -195,8 +195,8 @@ class GXmlTest {
                        try {
                                var doc = sr.read ();
                                message (doc.write_string ());
-                               var rootbuf = (string) (doc.document_element as 
GXml.Element).read_buffer.data;
-                               var childbuf = (string) (doc.document_element.child_nodes.item (0) as 
GXml.Element).read_buffer.data;
+                               var rootbuf = (string) ((GXml.Element) doc.document_element).read_buffer.data;
+                               var childbuf = (string) ((GXml.Element) doc.document_element.child_nodes.item 
(0)).read_buffer.data;
                                message (rootbuf);
                                message (childbuf);
                                assert (rootbuf == """<root p1="a" p2="b" ></root>""");
@@ -213,9 +213,9 @@ class GXmlTest {
                                var sr = new StreamReader (istream);
                                try {
                                        var doc = sr.read ();
-                                       (doc.document_element as GXml.Element).parse_buffer ();
+                                       ((GXml.Element) doc.document_element).parse_buffer ();
                                        message (doc.write_string ());
-                                       assert ((doc.document_element as GXml.Element).read_buffer == null);
+                                       assert (((GXml.Element) doc.document_element).read_buffer == null);
                                        loop.quit ();
                                } catch (GLib.Error e) {
                                        warning ("Error while reading stream: %s", e.message);
@@ -232,16 +232,16 @@ class GXmlTest {
                                var sr = new StreamReader (istream);
                                try {
                                        var doc = sr.read ();
-                                       (doc.document_element as GXml.Element).parse_buffer_async.begin 
((obj, res)=>{
+                                       ((GXml.Element) doc.document_element).parse_buffer_async.begin ((obj, 
res)=>{
                                                try {
-                                                       (doc.document_element as 
GXml.Element).parse_buffer_async.end (res);
+                                                       ((GXml.Element) 
doc.document_element).parse_buffer_async.end (res);
                                                        message (doc.write_string ());
-                                                       assert ((doc.document_element as 
GXml.Element).read_buffer == null);
+                                                       assert (((GXml.Element) 
doc.document_element).read_buffer == null);
                                                } catch (GLib.Error e) {
                                                        warning ("Error while reading stream: %s", e.message);
                                                }
                                        });
-                                       if ((doc.document_element as GXml.Element).parse_pending () != 0) {
+                                       if (((GXml.Element) doc.document_element).parse_pending () != 0) {
                                                return Source.CONTINUE;
                                        }
                                        loop.quit ();
@@ -300,7 +300,7 @@ class GXmlTest {
                                        assert (bs.books.get_item (1) is Book);
                                        foreach (DomNode n in bs.child_nodes) {
                                                if (n is DomElement) {
-                                                       assert ((n as GXml.Element).read_buffer != null);
+                                                       assert (((GXml.Element) n).read_buffer != null);
                                                }
                                        }
                                        bs.parse_buffer ();
diff --git a/test/XElementTest.vala b/test/XElementTest.vala
index a377c49..a2492c4 100644
--- a/test/XElementTest.vala
+++ b/test/XElementTest.vala
@@ -56,9 +56,9 @@ class XElementTest : GXmlTest  {
                                assert (doc.document_element.child_nodes[1] != null);
                                assert (doc.document_element.child_nodes[1] is DomElement);
                                assert (doc.document_element.child_nodes[1].node_name == "child");
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling != null);
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling is DomElement);
-                               assert ((doc.document_element.child_nodes[1] as 
DomElement).next_element_sibling.node_name == "child");
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling != null);
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling is DomElement);
+                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling.node_name == "child");
                                assert (doc.document_element.child_nodes[2] != null);
                                assert (doc.document_element.child_nodes[2].parent_node != null);
                                assert (doc.document_element.child_nodes[2].parent_node.node_name == "root");
@@ -66,9 +66,9 @@ class XElementTest : GXmlTest  {
                                assert (doc.document_element.child_nodes[3] != null);
                                assert (doc.document_element.child_nodes[3] is DomElement);
                                assert (doc.document_element.child_nodes[3].node_name == "child");
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling != null);
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling is DomElement);
-                               assert ((doc.document_element.child_nodes[3] as 
DomElement).previous_element_sibling.node_name == "child");
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling != null);
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling is DomElement);
+                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling.node_name == "child");
                                } catch (GLib.Error e) {
                                        Test.message (e.message);
                                        assert_not_reached ();
diff --git a/test/XHtmlDocumentTest.vala b/test/XHtmlDocumentTest.vala
index a123013..788be21 100644
--- a/test/XHtmlDocumentTest.vala
+++ b/test/XHtmlDocumentTest.vala
@@ -1510,7 +1510,7 @@ var _analytics_elem = document.getElementsByTagName('script')[0]; _analytics_ele
                """;
                        DomDocument doc;
                        doc = new XHtmlDocument.from_string (src);
-                       message ((doc as XDocument).to_string ());
+                       message (((XDocument) doc).to_string ());
                        assert (doc.document_element != null);
                        var c = doc.document_element.get_elements_by_property_value ("property", 
"article:published_time");
                        foreach (DomNode n in c) {
diff --git a/test/XPathTest.vala b/test/XPathTest.vala
index 08fee71..187754c 100644
--- a/test/XPathTest.vala
+++ b/test/XPathTest.vala
@@ -37,7 +37,7 @@ class XPathTest : GXmlTest  {
       } else
         document = new XDocument.from_string (BOOKS);
       assert (document != null);
-      var object = (document as GXml.XPathContext).evaluate ("/bookstore/book/title");
+      var object = ((XPathContext) document).evaluate ("/bookstore/book/title");
       assert (object.object_type == XPathObjectType.NODESET);
       var array = object.nodeset.to_array();
       assert (array.length == 4);
@@ -45,12 +45,12 @@ class XPathTest : GXmlTest  {
       assert (array[1].node_value == "Harry Potter");
       assert (array[2].node_value == "XQuery Kick Start");
       assert (array[3].node_value == "Learning XML");
-      object = (document as XPathContext).evaluate ("/bookstore/book[1]/title");
+      object = ((XPathContext) document).evaluate ("/bookstore/book[1]/title");
       assert (object.object_type == XPathObjectType.NODESET);
       array = object.nodeset.to_array();
       assert (array.length == 1);
       assert (array[0].node_value == "Everyday Italian");
-      object = (document as XPathContext).evaluate ("/bookstore/book/price[text()]");
+      object = ((XPathContext) document).evaluate ("/bookstore/book/price[text()]");
       assert (object.object_type == XPathObjectType.NODESET);
       array = object.nodeset.to_array();
       assert (array.length == 4);
@@ -58,7 +58,7 @@ class XPathTest : GXmlTest  {
       assert (array[1].node_value == "29.99");
       assert (array[2].node_value == "49.99");
       assert (array[3].node_value == "39.95");
-      object = (document as XPathContext).evaluate ("/bookstore/book[price>35]/price");
+      object = ((XPathContext) document).evaluate ("/bookstore/book[price>35]/price");
       assert (object.object_type == XPathObjectType.NODESET);
       array = object.nodeset.to_array();
       assert (array.length == 2);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]