[gxml] Tiny fixes.
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Tiny fixes.
- Date: Fri, 23 Aug 2013 20:55:35 +0000 (UTC)
commit 5b9afa4f0781bd56ab8097407fa1171e714dc2d7
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
Tiny fixes.
DomNode.vala: make check_wrong_document and check_read_only protected so only subclasses can see them
Element.vala: fix remove_attribute_node
ProcessingInstruction: properly get and set 'data'
gxml/DomNode.vala | 4 ++--
gxml/Element.vala | 8 ++------
gxml/ProcessingInstruction.vala | 12 +++++++++---
3 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index de6634a..b3f1440 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -48,14 +48,14 @@ namespace GXml {
/* Utility methods */
- private void check_wrong_document (DomNode node) {
+ protected void check_wrong_document (DomNode node) {
if (this.owner_document != node.owner_document) {
GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document
'%p' but belonged to document '%p'", this.owner_document, node.owner_document);
}
}
- internal bool check_read_only () {
+ protected bool check_read_only () {
// TODO: introduce a concept of read-only-ness, perhaps
// if read-only, raise NO_MODIFICATION_ALLOWED_ERR
return false;
diff --git a/gxml/Element.vala b/gxml/Element.vala
index 8d204c4..ada1dc6 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -328,13 +328,9 @@ namespace GXml {
* it wasn't found.
*/
public Attr remove_attribute_node (Attr old_attr) {
- Attr old;
-
- this.check_read_only ()
+ this.check_read_only ();
- // TODO: need to check for nulls. < Nope, ? controls that.
- old = this.attributes.remove (old_attr.name);
- if (old == null) {
+ if (this.attributes.remove (old_attr.name) == false) {
GLib.warning ("NOT_FOUND_ERR: No child with name '%s' exists in node '%s'",
old_attr.name, this.node_name);
}
diff --git a/gxml/ProcessingInstruction.vala b/gxml/ProcessingInstruction.vala
index 46f60b4..e268087 100644
--- a/gxml/ProcessingInstruction.vala
+++ b/gxml/ProcessingInstruction.vala
@@ -54,15 +54,21 @@ namespace GXml {
get;
private set;
}
+
+ 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;
+ get {
+ return _data;
+ }
set {
- this.check_read_only (); // TODO: does this prevent data from being set? test
- };
+ this.check_read_only ();
+ this._data = value;
+ }
}
/**
* The target name.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]