[gxml] Added ProcessingInstruction interface



commit 7fe9e8441fcb36d47868a101af25a266a3df5a24
Author: Daniel Espinosa <esodan gmail com>
Date:   Tue May 12 13:35:38 2015 -0500

    Added ProcessingInstruction interface

 gxml/Makefile.am                       |    1 +
 gxml/ProcessingInstruction.vala        |   38 ++++++++++++++++++++++++++++++++
 gxml/libxml-ProcessingInstruction.vala |   20 ++++++-----------
 3 files changed, 46 insertions(+), 13 deletions(-)
---
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index 97ceac4..26e1d9e 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -22,6 +22,7 @@ sources = \
        Namespace.vala \
        Node.vala \
        Notation.vala \
+       ProcessingInstruction.vala \
        Text.vala \
        libxml-Attr.vala \
        libxml-AttrChildNodeList.vala \
diff --git a/gxml/ProcessingInstruction.vala b/gxml/ProcessingInstruction.vala
new file mode 100644
index 0000000..6604281
--- /dev/null
+++ b/gxml/ProcessingInstruction.vala
@@ -0,0 +1,38 @@
+/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
+/* ObjectModel.vala
+ *
+ * Copyright (C) 2015  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;
+
+/**
+ * Base interface providing basic functionalities to all GXml interfaces.
+ */
+public interface GXml.ProcessingInstruction : Object, GXml.Node
+{
+  /**
+   * The target for the processing instruction, like "xml-stylesheet".
+   */
+  public abstract string target  { get; }
+  /**
+   * The data used by the target, like {{{href="style.xsl" type="text/xml"}}}
+   */
+  public abstract string data { get; }
+}
diff --git a/gxml/libxml-ProcessingInstruction.vala b/gxml/libxml-ProcessingInstruction.vala
index 6bf90dc..a907dcb 100644
--- a/gxml/libxml-ProcessingInstruction.vala
+++ b/gxml/libxml-ProcessingInstruction.vala
@@ -1,4 +1,4 @@
-/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
 /* ProcessingInstruction.vala
  *
  * Copyright (C) 2011-2013  Richard Schwarting <aquarichy gmail com>
@@ -40,35 +40,29 @@ namespace GXml {
         * {{{<?pi_target processing instruction data?>}}}
         * For more, see: [[http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1004215813]]
         */
-       public class xProcessingInstruction : xNode {
+       public class xProcessingInstruction : xNode, GXml.ProcessingInstruction {
+               string _target;
+               string _data;
                internal xProcessingInstruction (string target, string data, xDocument doc) {
                        base (NodeType.PROCESSING_INSTRUCTION, doc); // TODO: want to pass a real Xml.Node* ?
-                       this.target = target;
-                       this.data = data;
+                       this._target = target;
+                       this._data = data;
                }
 
                /**
                 * The target for the processing instruction, like "xml-stylesheet".
                 */
                public string target {
-                       get;
-                       private set;
+                       get { return _target; }
                }
 
-               private string _data;
-
                /**
                 * The data used by the target, like {{{href="style.xsl" type="text/xml"}}}
                 */
-               // TODO: confirm that data here is freeform attributes
                public string data /* throws DomError (not supported yet) */ {
                        get {
                                return _data;
                        }
-                       set {
-                               this.check_read_only ();
-                               this._data = value;
-                       }
                }
                /**
                 * The target name.


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