Tizen 2.1 base
[platform/framework/web/wrt-installer.git] / src / configuration_parser / parser_runner.cpp
index 79d5f16..6de0c0d 100644 (file)
@@ -206,7 +206,6 @@ class ParserRunner::Impl
         Assert(m_reader);
 
         Element element;
-        element.name = GetNameWithoutNamespace();
         element.value = GetValue();
         element.lang = GetLanguageTag();
         element.ns = GetNamespace();
@@ -228,11 +227,15 @@ class ParserRunner::Impl
             xmlTextReaderMoveToAttributeNo(m_reader, i);
 
             XmlAttribute attribute;
-            attribute.name = GetName();
+            attribute.ns = GetAttributeNamespace();
+            attribute.prefix = GetNamePrefix();
+            attribute.name = GetNameWithoutNamespace();
             attribute.value = GetValue();
             attribute.lang = GetLanguageTag();
             LogDebug("Attribute name: " << attribute.name <<
                      ", value: " << attribute.value <<
+                     ", prefix: " << attribute.prefix <<
+                     ", namespace: " << attribute.ns <<
                      ", lang: " << attribute.lang);
             parser->Accept(attribute);
         }
@@ -251,7 +254,8 @@ class ParserRunner::Impl
         DPL::String ret_value;
         const xmlChar* value = xmlTextReaderConstValue(m_reader);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
 
         return ret_value;
@@ -262,7 +266,21 @@ class ParserRunner::Impl
         DPL::String ret_value;
         const xmlChar* value = xmlTextReaderGetAttributeNo(m_reader, pos);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+        }
+        xmlFree(const_cast<xmlChar*>(value));
+
+        return ret_value;
+    }
+
+    DPL::String GetAttributeNamespace() const
+    {
+        DPL::String ret_value;
+        const xmlChar* value = xmlTextReaderLookupNamespace(m_reader, NULL);
+        if (value) {
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
         xmlFree(const_cast<xmlChar*>(value));
 
@@ -274,7 +292,20 @@ class ParserRunner::Impl
         DPL::String ret_value;
         const xmlChar* value = xmlTextReaderConstName(m_reader);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+        }
+
+        return ret_value;
+    }
+
+    DPL::String GetNamePrefix() const
+    {
+        DPL::String ret_value;
+        const xmlChar* value = xmlTextReaderPrefix(m_reader);
+        if (value) {
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
 
         return ret_value;
@@ -285,7 +316,8 @@ class ParserRunner::Impl
         DPL::String ret_value;
         const xmlChar* value = xmlTextReaderLocalName(m_reader);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
 
         return ret_value;
@@ -294,9 +326,11 @@ class ParserRunner::Impl
     DPL::String GetNamespace() const
     {
         DPL::String ret_value;
+
         const xmlChar* value = xmlTextReaderConstNamespaceUri(m_reader);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
 
         return ret_value;
@@ -307,7 +341,8 @@ class ParserRunner::Impl
         DPL::String ret_value;
         const xmlChar* value = xmlTextReaderConstXmlLang(m_reader);
         if (value) {
-            ret_value = DPL::FromUTF8String(reinterpret_cast<const char*>(value));
+            ret_value =
+                DPL::FromUTF8String(reinterpret_cast<const char*>(value));
         }
 
         return ret_value;