[gxml] Ported to Vala 0.36. Removing Xmlx namespace
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Ported to Vala 0.36. Removing Xmlx namespace
- Date: Thu, 2 Mar 2017 21:27:01 +0000 (UTC)
commit f99b0e1942f92f450ca4f9e96474a274719b153c
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Mar 2 12:54:25 2017 -0600
Ported to Vala 0.36. Removing Xmlx namespace
gxml/GXmlDocument.vala | 12 ++++++------
gxml/Makefile.am | 1 -
gxml/TDocument.vala | 12 ++++++------
gxml/XParser.vala | 10 +++++-----
gxml/xlibxml.c | 1 -
test/TCDATATest.vala | 8 +++-----
6 files changed, 20 insertions(+), 24 deletions(-)
---
diff --git a/gxml/GXmlDocument.vala b/gxml/GXmlDocument.vala
index 48bae9b..60317b0 100644
--- a/gxml/GXmlDocument.vala
+++ b/gxml/GXmlDocument.vala
@@ -60,9 +60,9 @@ public class GXml.GDocument : GXml.GNode,
}
public GDocument.from_string (string str, int options = 0) throws GLib.Error {
- Xmlx.reset_last_error ();
+ Xml.reset_last_error ();
doc = Xml.Parser.parse_memory (str, (int) str.length);
- var e = Xmlx.get_last_error ();
+ var e = Xml.get_last_error ();
if (e != null) {
var errmsg = "Parser Error for string";
string s = libxml2_error_to_string (e);
@@ -134,9 +134,9 @@ public class GXml.GDocument : GXml.GNode,
}
public GXml.Node GXml.Document.create_element (string name) throws GLib.Error
{
- Xmlx.reset_last_error ();
+ Xml.reset_last_error ();
var el = doc->new_raw_node (null, name, null);
- var e = Xmlx.get_last_error ();
+ var e = Xml.get_last_error ();
if (e != null) {
var errmsg = "Parser Error for string";
string s = libxml2_error_to_string (e);
@@ -161,8 +161,8 @@ public class GXml.GDocument : GXml.GNode,
#if DEBUG
GLib.message ("TDocument: to_string ()");
#endif
- Xml.Doc doc = new Xml.Doc ();
- Xml.TextWriter tw = Xmlx.new_text_writer_doc (ref doc);
+ Xml.Doc doc = null;
+ Xml.TextWriter tw = new Xml.TextWriter.doc (out doc);
try { TDocument.write_document (this, tw); } catch { return "<?xml version=\"0\"?>"; }
string str;
int size;
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index 031ce0e..5b70f0f 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -102,7 +102,6 @@ AM_VALAFLAGS= \
$(ERROR_AM_VALAFLAGS) \
--library=gxml-0.14 \
$(top_srcdir)/vapi/config.vapi \
- $(top_srcdir)/vapi/xlibxml-1.0.vapi \
--vapidir=. \
--vapidir=$(top_srcdir)/vapi \
--pkg libxml-2.0 \
diff --git a/gxml/TDocument.vala b/gxml/TDocument.vala
index 9722ac0..1567379 100644
--- a/gxml/TDocument.vala
+++ b/gxml/TDocument.vala
@@ -164,7 +164,7 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
}
public GXml.Node create_element (string name) throws GLib.Error
{
- if (Xmlx.validate_name (name, 1) != 0)
+ if (Xml.Tree.validate_name (name) != 0)
throw new GXml.Error.PARSER (_("Invalid element name"));
return new TElement (this, name);
}
@@ -200,7 +200,7 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
throws GLib.Error
{
var buf = new Xml.Buffer ();
- var tw = Xmlx.new_text_writer_memory (buf, 0);
+ var tw = new Xml.TextWriter.memory (buf);
write_document (doc, tw);
var s = new GLib.StringBuilder ();
s.append (buf.content ());
@@ -419,7 +419,7 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
#if DEBUG
GLib.message (@"Starting Child Element: writting CDATA '$(n.value)'");
#endif
- size += Xmlx.text_writer_write_cdata (tw, n.value);
+ size += tw.write_cdata (n.value);
if (size > 1500)
tw.flush ();
}
@@ -427,7 +427,7 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
#if DEBUG
GLib.message (@"Starting Child Element: writting ProcessingInstruction '$(n.value)'");
#endif
- size += Xmlx.text_writer_write_pi (tw, ((ProcessingInstruction) n).target, ((ProcessingInstruction)
n).data);
+ size += tw.write_pi (((ProcessingInstruction) n).target, ((ProcessingInstruction) n).data);
if (size > 1500)
tw.flush ();
}
@@ -439,8 +439,8 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
#if DEBUG
GLib.message ("TDocument: to_string ()");
#endif
- Xml.Doc doc = new Xml.Doc ();
- Xml.TextWriter tw = Xmlx.new_text_writer_doc (ref doc);
+ Xml.Doc doc = null;
+ Xml.TextWriter tw = new TextWriter.doc (out doc);
write_document (this, tw);
string str;
int size;
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index e34090d..ed71295 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -54,7 +54,7 @@ public class GXml.XParser : Object, GXml.Parser {
public void write_stream (OutputStream stream,
GLib.Cancellable? cancellable = null) throws GLib.Error {
var buf = new Xml.Buffer ();
- tw = Xmlx.new_text_writer_memory (buf, 0);
+ tw = new TextWriter.memory (buf);
if (_node is DomDocument) tw.start_document ();
tw.set_indent (indent);
// Root
@@ -549,8 +549,8 @@ public class GXml.XParser : Object, GXml.Parser {
private string dump () throws GLib.Error {
int size;
- Xml.Doc doc = new Xml.Doc ();
- tw = Xmlx.new_text_writer_doc (ref doc);
+ Xml.Doc doc = null;
+ tw = new TextWriter.doc (out doc);
if (_node is DomDocument) tw.start_document ();
tw.set_indent (indent);
// Root
@@ -698,8 +698,8 @@ public class GXml.XParser : Object, GXml.Parser {
#if DEBUG
GLib.message (@"Starting Child Element: writting ProcessingInstruction '$(n.node_value)'");
#endif
- size += Xmlx.text_writer_write_pi (tw, (n as DomProcessingInstruction).target,
- (n as DomProcessingInstruction).data);
+ size += tw.write_pi ((n as DomProcessingInstruction).target,
+ (n as DomProcessingInstruction).data);
if (size > 1500)
tw.flush ();
}
diff --git a/gxml/xlibxml.c b/gxml/xlibxml.c
index f7c4cdb..e25ab69 100644
--- a/gxml/xlibxml.c
+++ b/gxml/xlibxml.c
@@ -64,7 +64,6 @@ void gxml_reset_last_error ()
{
xmlResetLastError ();
}
-
xmlNsPtr* gxml_doc_get_ns_list (xmlDoc* doc, xmlNode* node)
{
g_return_val_if_fail (doc != NULL, NULL);
diff --git a/test/TCDATATest.vala b/test/TCDATATest.vala
index 7825656..506ff9b 100644
--- a/test/TCDATATest.vala
+++ b/test/TCDATATest.vala
@@ -29,20 +29,18 @@ class TCDATATest : GXmlTest {
var d = new TDocument ();
var r = d.create_element ("root");
d.children_nodes.add (r);
+ assert (d.children_nodes.size == 1);
+ GLib.message (@"$d");
var cd = d.create_cdata ("<test/>");
assert (cd.value == "<test/>");
d.root.children_nodes.add (cd);
assert (d.root.children_nodes.size == 1);
string str = d.to_string ();
- assert ("<root><![CDATA[<test/>]]></root>" in str);
-#if DEBUG
GLib.message (@"$d");
-#endif
+ assert ("<root><![CDATA[<test/>]]></root>" in str);
}
catch (GLib.Error e) {
-#if DEBUG
GLib.message (@"ERROR: $(e.message)");
-#endif
assert_not_reached ();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]