[gxml] DOM4: Implementing DomAttr on GAttribute
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] DOM4: Implementing DomAttr on GAttribute
- Date: Mon, 18 Jul 2016 05:45:02 +0000 (UTC)
commit e2fcf886bef112db6347c5a9bc38fe4a057ec3c0
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Jul 13 16:27:41 2016 -0500
DOM4: Implementing DomAttr on GAttribute
This is a work in progress, it doesn't compile at all. Requires to
implement all interfaces before start to fix compilation.
gxml/DomAttr.vala | 2 +-
gxml/GXmlAttribute.vala | 33 ++++++++++++++++++++++++++++++---
gxml/GXmlDocument.vala | 2 +-
gxml/GXmlElement.vala | 2 +-
4 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/gxml/DomAttr.vala b/gxml/DomAttr.vala
index ee403f7..6eb844d 100644
--- a/gxml/DomAttr.vala
+++ b/gxml/DomAttr.vala
@@ -27,5 +27,5 @@ public interface GXml.DomAttr {
public abstract string name { get; }
public abstract string @value { get; set; }
- public abstract bool specified { get; } // useless; always returns true
+ public virtual bool specified { get { return true; } } // useless; always returns true
}
diff --git a/gxml/GXmlAttribute.vala b/gxml/GXmlAttribute.vala
index fdd6353..a32e371 100644
--- a/gxml/GXmlAttribute.vala
+++ b/gxml/GXmlAttribute.vala
@@ -24,7 +24,7 @@ using Gee;
/**
* Class implemeting {@link GXml.Attribute} interface, not tied to libxml-2.0 library.
*/
-public class GXml.GAttribute : GXml.GNode, GXml.Attribute
+public class GXml.GAttribute : GXml.GNode, GXml.Attribute, GXml.DomAttr
{
private Xml.Attr* _attr;
public GAttribute (GDocument doc, Xml.Attr *node)
@@ -51,7 +51,7 @@ public class GXml.GAttribute : GXml.GNode, GXml.Attribute
}
}
- public override string name {
+ public override string GXml.Node.name {
owned get {
return _attr->name.dup ();
}
@@ -73,7 +73,7 @@ public class GXml.GAttribute : GXml.GNode, GXml.Attribute
_node->set_ns_prop (_attr->ns, _attr->name, value);
}
}
- public string prefix {
+ public string GXml.Attribute.prefix {
owned get {
if (_attr == null) return "";
if (_attr->ns == null) return "";
@@ -86,4 +86,31 @@ public class GXml.GAttribute : GXml.GNode, GXml.Attribute
return to_gnode (document as GDocument, _node);
}
}
+ // DomAttr implementation
+ public string? namespace_uri {
+ get {
+ if (namespace == null) return null;
+ return namespace.uri;
+ }
+ }
+ public string? GXml.DomAttr.prefix {
+ get {
+ if (namespace == null) return null;
+ return namespace.prefix;
+ }
+ }
+ public string local_name { get { return (this as GXml.Node).name; } }
+ public string GXml.DomAttr.name {
+ get {
+ if (namespace == null) return (this as GXml.Node).name;
+ }
+ }
+ public string @value {
+ get {
+ return (this as GXml.Node).value;
+ }
+ set {
+ (this as GXml.Node).value = value;
+ }
+ }
}
diff --git a/gxml/GXmlDocument.vala b/gxml/GXmlDocument.vala
index a63036e..8e729dc 100644
--- a/gxml/GXmlDocument.vala
+++ b/gxml/GXmlDocument.vala
@@ -29,7 +29,7 @@ using Xml;
* This class use {@link Xml.TextWriter} to write down XML documents using
* its contained {@link GXml.Node} childs or other XML structures.
*/
-public class GXml.GDocument : GXml.GNode, GXml.Document
+public class GXml.GDocument : GXml.GNode, GXml.Document, GXml.DomDocument
{
protected Xml.Doc* doc;
protected Xml.Buffer _buffer;
diff --git a/gxml/GXmlElement.vala b/gxml/GXmlElement.vala
index af0b4d4..252fe88 100644
--- a/gxml/GXmlElement.vala
+++ b/gxml/GXmlElement.vala
@@ -25,7 +25,7 @@ using Gee;
/**
* Class implemeting {@link GXml.Element} interface, not tied to libxml-2.0 library.
*/
-public class GXml.GElement : GXml.GNode, GXml.Element
+public class GXml.GElement : GXml.GNode, GXml.Element, GXml.DomElement
{
public GElement (GDocument doc, Xml.Node *node) {
_node = node;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]