summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-29 23:44:36 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-29 23:44:36 +0000
commit5eba18a08b9821fa10cc03af8dbd7d1c10653b13 (patch)
treea4a3203a8161b9c804d277eb60b522f0e93b3076
parent7c95a2e706f0e6511d76c6f3fddba656d3ef8b7b (diff)
downloadlibdom-5eba18a08b9821fa10cc03af8dbd7d1c10653b13.tar.gz
libdom-5eba18a08b9821fa10cc03af8dbd7d1c10653b13.tar.bz2
Implement dom_characterdata_get_data()
Implement dom_characterdata_set_data() svn path=/trunk/dom/; revision=3610
-rw-r--r--src/core/characterdata.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/core/characterdata.c b/src/core/characterdata.c
index 91aa93d..88aaff2 100644
--- a/src/core/characterdata.c
+++ b/src/core/characterdata.c
@@ -10,6 +10,7 @@
#include "core/characterdata.h"
#include "core/document.h"
+#include "core/node.h"
#include "utils/utils.h"
/**
@@ -63,10 +64,14 @@ void dom_characterdata_finalise(struct dom_document *doc,
dom_exception dom_characterdata_get_data(struct dom_characterdata *cdata,
struct dom_string **data)
{
- UNUSED(cdata);
- UNUSED(data);
+ struct dom_node *c = (struct dom_node *) cdata;
- return DOM_NOT_SUPPORTED_ERR;
+ if (c->value != NULL) {
+ dom_string_ref(c->value);
+ }
+ *data = c->value;
+
+ return DOM_NO_ERR;
}
/**
@@ -84,10 +89,20 @@ dom_exception dom_characterdata_get_data(struct dom_characterdata *cdata,
dom_exception dom_characterdata_set_data(struct dom_characterdata *cdata,
struct dom_string *data)
{
- UNUSED(cdata);
- UNUSED(data);
+ struct dom_node *c = (struct dom_node *) cdata;
- return DOM_NOT_SUPPORTED_ERR;
+ if (_dom_node_readonly(c)) {
+ return DOM_NO_MODIFICATION_ALLOWED_ERR;
+ }
+
+ if (c->value != NULL) {
+ dom_string_unref(c->value);
+ }
+
+ dom_string_ref(data);
+ c->value = data;
+
+ return DOM_NO_ERR;
}
/**