[gxml] * add NamespaceAttr, an Attr that defines an NS



commit f81a4e77e202f4528af623f6d0159e0304c4c22e
Author: Richard Schwarting <aquarichy gmail com>
Date:   Tue Aug 16 03:10:38 2011 +0200

    * add NamespaceAttr, an Attr that defines an NS

 gxml/NamespaceAttr.vala |  103 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 103 insertions(+), 0 deletions(-)
---
diff --git a/gxml/NamespaceAttr.vala b/gxml/NamespaceAttr.vala
new file mode 100644
index 0000000..94cf5b3
--- /dev/null
+++ b/gxml/NamespaceAttr.vala
@@ -0,0 +1,103 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+namespace GXml.Dom {
+	/**
+	 * Represents an XML Namespace Attr node. These represent
+	 * prefix=uri pairs that define namespaces for XML Elements
+	 * and Attrs.
+	 */
+	public class NamespaceAttr : XNode {
+		/** Private properties */
+		private Xml.Ns *node;
+
+		/** Constructors */
+		internal NamespaceAttr (Xml.Ns *node, Document doc) {
+			// TODO: wish valac would warn against using this. before calling base()
+			base (NodeType.ATTRIBUTE, doc); // TODO: want something other than ATTRIBUTE?
+			this.node = node;
+		}
+
+		/* Public properties (Node general) */
+
+
+		/**
+		 * The prefix that this xmlns attribute defines.  So,
+		 * if the element was like [[[<Fish
+		 * xmlns:foods="http://fishies.org/foods"; />]]], the
+		 * defined prefix would be foods.
+		 */ 
+		public string defined_prefix {
+			get {
+				return this.node_name;
+			}
+			internal set {
+			}
+		}
+
+		/**
+		 * The namespace uri that this xmlns attribute defines.  So,
+		 * if the element was like [[[<Fish
+		 * xmlns:foods="http://fishies.org/foods"; />]]], the
+		 * defined namespace uri would be http://fishies.org/foods/.
+		 */ 
+		public string defined_namespace_uri {
+			get {
+				return this.node_value;
+			}
+			internal set {
+			}
+		}
+
+
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? namespace_uri {
+			get {
+				return null; // TODO: figure out the uri for 'xmlns'
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? prefix {
+			get {
+				return "xmlns";
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? local_name {
+			get {
+				return this.node_name;
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string node_name {
+			get {
+				return this.node->prefix;
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? node_value {
+			get {
+				return this.node->href;
+			}
+			internal set {
+			}
+		}
+	}
+}



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