[gnote] Fix xml_node_content
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix xml_node_content
- Date: Sat, 4 Feb 2012 16:51:45 +0000 (UTC)
commit 30019d4a7e9e64643be6d99ad266ff25bb008cef
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sat Feb 4 18:47:11 2012 +0200
Fix xml_node_content
Handle properly attribute nodes.
src/synchronization/filesystemsyncserver.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/synchronization/filesystemsyncserver.cpp b/src/synchronization/filesystemsyncserver.cpp
index f8fe006..39e2ede 100644
--- a/src/synchronization/filesystemsyncserver.cpp
+++ b/src/synchronization/filesystemsyncserver.cpp
@@ -38,13 +38,17 @@ namespace {
std::string xml_node_content(xmlNodePtr node)
{
- xmlNodePtr child = xmlFirstElementChild(node);
- if(child) {
- char *res = reinterpret_cast<char*>(XML_GET_CONTENT(child));
- return res ? res : "";
+ if(!node) {
+ return "";
}
-
- return "";
+ if(node->type == XML_ATTRIBUTE_NODE) {
+ node = xmlGetLastChild(node);
+ if(!node) {
+ return "";
+ }
+ }
+ char *res = reinterpret_cast<char*>(XML_GET_CONTENT(node));
+ return res ? res : "";
}
int str_to_int(const std::string & s)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]