[gxml] Parser: New Parser interface and XParser class
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Parser: New Parser interface and XParser class
- Date: Mon, 31 Oct 2016 04:13:06 +0000 (UTC)
commit 3b6aaec2e4ce252285aa63b6206a193192763d10
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Oct 27 17:21:33 2016 -0500
Parser: New Parser interface and XParser class
Parser is intented to be an interface to read and write XML documents
to be implemented by different engines.
gxml/Makefile.am | 2 ++
gxml/Parser.vala | 37 +++++++++++++++++++++++++++++++++++++
gxml/XParser.vala | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index 5a535d9..602281d 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -88,6 +88,8 @@ sources = \
GomNode.vala \
GomText.vala \
GomObject.vala \
+ Parser.vala \
+ XParser.vala \
$(NULL)
diff --git a/gxml/Parser.vala b/gxml/Parser.vala
new file mode 100644
index 0000000..7f2c894
--- /dev/null
+++ b/gxml/Parser.vala
@@ -0,0 +1,37 @@
+/* TNode.vala
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+/**
+ * XML parser engine for {@link DomDocument} implementations.
+ */
+public interface GXml.Parser : Object {
+ public abstract DomDocument document { get; }
+ public abstract void save (GLib.File f,
+ GLib.Cancellable? cancellable) throws GLib.Error;
+ public abstract void read (GLib.File f,
+ GLib.Cancellable? cancellable) throws GLib.Error;
+ public abstract string to_string () throws GLib.Error;
+ public abstract void to_stream (OutputStream stream) throws GLib.Error;
+ public abstract void from_stream (InputStream stream) throws GLib.Error;
+ public abstract void from_string (string str);
+}
diff --git a/gxml/XParser.vala b/gxml/XParser.vala
new file mode 100644
index 0000000..373e3cd
--- /dev/null
+++ b/gxml/XParser.vala
@@ -0,0 +1,41 @@
+/* TNode.vala
+ *
+ * Copyright (C) 2016 Daniel Espinosa <esodan gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Daniel Espinosa <esodan gmail com>
+ */
+
+using Gee;
+
+/**
+ * {@link Parser} implementation using libxml2 engine
+ */
+public class GXml.XParser : Object, GXml.Parser {
+ DomDocument _document;
+ public DomDocument document { get { return _document; } }
+
+ public XParser (DomDocument doc) { _document = doc; }
+
+ public void save (GLib.File f, GLib.Cancellable? cancellable)
+ throws GLib.Error {}
+ public void read (GLib.File f, GLib.Cancellable? cancellable)
+ throws GLib.Error {}
+ public string to_string () throws GLib.Error { return ""; }
+ public void to_stream (OutputStream stream) throws GLib.Error {}
+ public void from_stream (InputStream stream) throws GLib.Error {}
+ public void from_string (string str) {}
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]