[gxml] GomElement: added read_from_stream()
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomElement: added read_from_stream()
- Date: Wed, 15 Feb 2017 00:49:54 +0000 (UTC)
commit 5b65663e072ec2220fb6487e5237796590f228e7
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Feb 14 18:48:31 2017 -0600
GomElement: added read_from_stream()
Also read_from_file is cacancellable
gxml/GomElement.vala | 15 ++++++++++++---
gxml/XParser.vala | 4 ++--
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index 9eb52f6..259c7d0 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -45,11 +45,20 @@ public class GXml.GomElement : GomNode,
this.read_from_file (File.new_for_uri (uri));
}
/**
- * Parses an XML file, deserializing it over {@link GomElemen}.
+ * Parses an XML file, deserializing it over {@link GomElement}.
*/
- public void read_from_file (GLib.File f) throws GLib.Error {
+ public void read_from_file (GLib.File f,
+ GLib.Cancellable? cancellable = null) throws GLib.Error {
var parser = new XParser (this);
- parser.read_file (f, null);
+ parser.read_file (f, cancellable);
+ }
+ /**
+ * Parses an XML over a {@link GLib.InputStream}, deserializing it over {@link GomElement}.
+ */
+ public void read_from_stream (GLib.InputStream istream,
+ GLib.Cancellable? cancellable = null) throws GLib.Error {
+ var parser = new XParser (this);
+ parser.read_stream (istream, cancellable);
}
/**
* Parses an XML string, deserializing it over {@link GomElemen}.
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
index 7f3be63..8ff97b3 100644
--- a/gxml/XParser.vala
+++ b/gxml/XParser.vala
@@ -52,7 +52,7 @@ public class GXml.XParser : Object, GXml.Parser {
}
public void write_stream (OutputStream stream,
- GLib.Cancellable? cancellable) throws GLib.Error {
+ GLib.Cancellable? cancellable = null) throws GLib.Error {
var buf = new Xml.Buffer ();
tw = Xmlx.new_text_writer_memory (buf, 0);
if (_node is DomDocument) tw.start_document ();
@@ -94,7 +94,7 @@ public class GXml.XParser : Object, GXml.Parser {
public void read_stream (GLib.InputStream istream,
- GLib.Cancellable? cancellable) throws GLib.Error {
+ GLib.Cancellable? cancellable = null) throws GLib.Error {
var b = new MemoryOutputStream.resizable ();
b.splice (istream, 0);
#if DEBUG
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]