[gxml] * add name space properties from DOM Level 2 Core. Note that it's possible to have a list of namesp



commit f7fc3e7c213d70922e219e2d879e98d7a2d27530
Author: Richard Schwarting <aquarichy gmail com>
Date:   Mon Aug 8 16:29:09 2011 +0200

    * add name space properties from DOM Level 2 Core.  Note that it's possible to have a list of namespaces, but these only support the first encountered.

 gxml/BackedNode.vala |   36 ++++++++++++++++++++++++++++++++++++
 gxml/XNode.vala      |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/gxml/BackedNode.vala b/gxml/BackedNode.vala
index 6993734..10a8d5d 100644
--- a/gxml/BackedNode.vala
+++ b/gxml/BackedNode.vala
@@ -27,6 +27,42 @@ namespace GXml.Dom {
 
 
 		/* Public properties */
+
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? namespace_uri {
+			get {
+				// TODO: there can be multiple NSes on a node, using ->next, right now we just return the first.  What should we do?!?!
+				return this.node->ns_def->href;
+				// TODO: handle null ns_def
+				// TODO: figure out when node->ns is used, as opposed to ns_def
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? prefix {
+			get {
+				return this.node->ns_def->prefix;
+				// TODO: handle null ns
+			}
+			internal set {
+			}
+		}
+		/**
+		 * { inheritDoc}
+		 */
+		public override string? local_name {
+			get {
+				return this.node_name;
+			}
+			internal set {
+			}
+		}
+
 		/* None of the following should store any data locally (except the attribute table), they should get data from Xml.Node* */
 
 		// TODO: make sure that subclasses obey the table in Node for node_name, node_value, and attributes; probably figure it out as I create tests for them.
diff --git a/gxml/XNode.vala b/gxml/XNode.vala
index ff1b1e7..34f1ff0 100644
--- a/gxml/XNode.vala
+++ b/gxml/XNode.vala
@@ -18,6 +18,44 @@ namespace GXml.Dom {
 		}
 
 		/**
+		 * Stores the URI describing the node's namespace.
+		 * This only applies to Elements and Attrs from DOM
+		 * Level 2 Core that were created with namespace
+		 * support.
+		 */
+		public virtual string? namespace_uri {
+			get {
+				return null;
+			}
+			internal set {
+			}
+		}
+		/**
+		 * Stores the namespace prefix for the node.  This
+		 * only applies to Elements and Attrs from DOM Level 2
+		 * Core that were created with namespace support.
+		 */
+		public virtual string? prefix {
+			get {
+				return null;
+			}
+			internal set {
+			}
+		}
+		/**
+		 * Stores the local name within the namespace. This
+		 * only applies to Elements and Attrs from DOM Level 2
+		 * Core that were created with namespace support.
+		 */
+		public virtual string? local_name {
+			get {
+				return null;
+			}
+			internal set {
+			}
+		}
+
+		/**
 		 * Stores the value of the Node. The nature of
 		 * node_value varies based on the type of node. This
 		 * can be null.



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