2 * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "xml_parser_utils.h"
26 get_content_int(const xmlNodePtr cur_node) {
27 assert(cur_node != NULL);
31 xmlChar* key = xmlNodeGetContent(cur_node);
33 if (0 == strcmp("NOT_USED", (const char*)key)) {
36 num = atoi((const char*)key);
44 get_content_bool(const xmlNodePtr cur_node) {
45 assert(cur_node != NULL);
49 xmlChar* key = xmlNodeGetContent(cur_node);
52 if (0 == xmlStrcmp(key, (const xmlChar*)"true")) {
61 equal_prop(const xmlNodePtr cur_node, const char* prop, const char* str) {
64 xmlChar* key = xmlGetProp(cur_node, (const xmlChar*)prop);
67 if (0 == xmlStrcmp(key, (const xmlChar*)str)) {
77 get_prop_bool(const xmlNodePtr cur_node, const char* prop, sclboolean *ret) {
78 assert(cur_node != NULL);
80 bool succeeded = false;
82 xmlChar* key = xmlGetProp(cur_node, (const xmlChar*)prop);
84 if (ret && key != NULL) {
86 if (0 == xmlStrcmp(key, (const xmlChar*)"true")) {
98 dex_string_to_int(const char* str) {
102 stringstream convertor(str);
104 convertor >> hex >> val;
105 if (convertor.fail() == true) {
113 get_content_dex_string_int(const xmlNodePtr cur_node) {
114 assert(NULL != cur_node);
118 xmlChar* key = xmlNodeGetContent(cur_node);
121 val = dex_string_to_int((const char*)key);