[gxml] GomNode: Removed to_string()



commit 28e503acc0810058029bb1d4dfa2a7d8a9dab817
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Nov 2 18:00:28 2016 -0600

    GomNode: Removed to_string()
    
    Write a node is like a write a document, may
    we need to create a DocumentFragment instead
    to write out to string just required nodes.

 gxml/GomNode.vala        |    4 ----
 gxml/Parser.vala         |    4 ----
 gxml/XParser.vala        |    2 --
 test/GomElementTest.vala |   20 --------------------
 4 files changed, 0 insertions(+), 30 deletions(-)
---
diff --git a/gxml/GomNode.vala b/gxml/GomNode.vala
index a000dee..fe307d6 100644
--- a/gxml/GomNode.vala
+++ b/gxml/GomNode.vala
@@ -284,10 +284,6 @@ public class GXml.GomNode : Object,
   public bool dispatch_event (DomEvent event)
   { return false; } // FIXME:
 
-  // To String
-  public string to_string () {
-    return (_document as GomDocument).parser.write_node (this);
-  }
 }
 
 /**
diff --git a/gxml/Parser.vala b/gxml/Parser.vala
index dd0e4f8..4d16ca3 100644
--- a/gxml/Parser.vala
+++ b/gxml/Parser.vala
@@ -49,10 +49,6 @@ public interface GXml.Parser : Object {
    */
   public abstract void write_stream (OutputStream stream,
                                     GLib.Cancellable? cancellable) throws GLib.Error;
-  /**
-   * Writes a {@link GXml.DomNode} to a string
-   */
-  public abstract string write_node (DomNode node) throws GLib.Error;
 
   /**
    * Read a {@link GXml.DomDocument} from a {@link GLib.File}
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index ab65ecb..7f80c7d 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -41,8 +41,6 @@ public class GXml.XParser : Object, GXml.Parser {
   public string write_string () throws GLib.Error  {
     return dump ();
   }
-  public string write_node (DomNode node) throws GLib.Error { return ""; }
-
   public void read_string (string str, GLib.Cancellable? cancellable) throws GLib.Error {
     if (str == "")
       throw new ParserError.INVALID_DATA_ERROR (_("Invalid document string, is empty is not allowed"));
diff --git a/test/GomElementTest.vala b/test/GomElementTest.vala
index 3048a74..dca6aab 100644
--- a/test/GomElementTest.vala
+++ b/test/GomElementTest.vala
@@ -141,25 +141,6 @@ class GomElementTest : GXmlTest  {
                                assert_not_reached ();
                        }
                });
-               Test.add_func ("/gxml/gom-element/to_string", () =>{
-                       try {
-                               GomDocument doc = new GomDocument.from_string ("<root />");
-                               var elem = doc.create_element ("country");
-                               var t = doc.create_text_node ("New Zealand");
-                               assert (t != null);
-                               elem.child_nodes.add (t);
-                               Test.message ("Elem1:"+(elem as GomNode).to_string ());
-                               assert ((elem as GomElement).to_string () == "<country>New 
Zealand</country>");
-                               var elem2 = doc.create_element ("messy");
-                               var t2 = doc.create_text_node ("&lt;<>&gt;");
-                               elem2.child_nodes.add (t2);
-                               Test.message ("Elem2:"+(elem2 as GomNode).to_string ());
-                               assert ((elem2 as GomNode).to_string () == 
"<messy>&amp;lt;&lt;&gt;&amp;gt;</messy>");
-                       } catch (GLib.Error e) {
-                               Test.message (e.message);
-                               assert_not_reached ();
-                       }
-               });
                Test.add_func ("/gxml/gom-element/content/add_aside_child_nodes", () =>{
                        try {
                                var doc = new GomDocument ();
@@ -170,7 +151,6 @@ class GomElementTest : GXmlTest  {
                                var t = doc.create_text_node ("TEXT1");
                                root.child_nodes.add (t);
                                string s = doc.to_string ().split ("\n")[1];
-                               Test.message ("root="+root.to_string ());
                                assert (s == "<root><child/>TEXT1</root>");
                        } catch (GLib.Error e) {
                                Test.message (e.message);


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