summaryrefslogtreecommitdiffstats
path: root/nsframework/framework_unified/client/NS_XMLConfigeParser/library
diff options
context:
space:
mode:
Diffstat (limited to 'nsframework/framework_unified/client/NS_XMLConfigeParser/library')
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile19
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk25
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h113
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h104
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h60
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h88
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile57
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001208
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp522
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp338
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp354
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp55
-rwxr-xr-xnsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp658
13 files changed, 0 insertions, 2601 deletions
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
deleted file mode 100755
index 520b5f7..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SUBDIRS = src
-
-include ../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
deleted file mode 100755
index 93b9f97..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/cfg/depends.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Standard Dependency Makefile Version 2.0
-#
-# Dependency file dictates not only what other modules the project is dependent on, but
-# also where to get that dependent element which logically includes versioning or
-# baselining information
-
-# Utilizing Base Domain Dependency File. Can override at any point
-include $(PRJ_ROOT)/../NativeServices/cfg/depends.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
deleted file mode 100755
index 4186f09..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup MY 14 Platfom Software Team
-/// \brief Internal Header for ns_config_parser_XML.c
-///
-/// These functions are used to read from and write to XML file.
-///
-///
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
-#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#include <ns_config_parser_internal.h>
-#define BUFFERSIZE 200
-#define ZERO 0
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// XMLGetValue:
-/// Function : get value for given key.
-///
-/// \param [in] pCurrNode
-/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
-/// \param [in] pNodePath
-/// const char * - pNodePath is a Pointer to path of Current XML node.
-/// \param [in] pUserKey
-/// const char * - pUserKey is a Pointer to Key provided by user.
-/// \param [in] pReturnValue
-/// char * - pReturnValue is a Pointer to value to be returned corresponding to Key.
-/// \param [in] pReturnState
-/// int * - pReturnState is updated depending upon user provided Key\n
-/// returns 0 if user passed valid key.\n
-/// returns 1 if user passed invalid key.\n
-/// \return status
-/// void
-///////////////////////////////////////////////////////////////////////////////////////////
-void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue,
- int *preturnstate);
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// XMLUpdateOldValue:
-/// Function : update value corresponding to given user key.
-///
-/// \param [in] pCurrNode
-/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
-/// \param [in] pNodePath
-/// const char * - pNodePath is a Pointer to path of Current XML node.
-/// \param [in] pUserKey
-/// const char * - pUserKey is a Pointer to Key provided by user.
-/// \param [in] pValue
-/// const char * - pValue is a Pointer to the new value for attribute or text.
-/// \param [in] pReturnState
-/// int * - returns 0 if user passed valid key.\n
-/// returns -6 if old value is not updated with new value.\n
-/// \return status
-/// void
-///////////////////////////////////////////////////////////////////////////////////////////
-void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue,
- int *preturnstate);
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// XMLUpdateOldValueWithNewValue:
-/// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n
-/// if old value matched then write new value in place of old value.
-///
-/// \param [in] pCurrNode
-/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
-/// \param [in] pNodePath
-/// const char * -pNodePath is a Pointer to path of Current XML node.
-/// \param [in] pUserKey
-/// const char * -pUserKey is a Pointer to Key provided by user.
-/// \param [in] pOldValue
-/// const char * - pOldValue is a Pointer to the old value for attribute or text of key passed.
-/// \param [in] pNewValue
-/// const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key.
-/// \param [in] pReturnState
-/// int * - returns 0 if user passed valid key.\n
-/// returns -6 if old value is not updated with new value.\n
-/// \return status
-/// void
-///////////////////////////////////////////////////////////////////////////////////////////
-void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey,
- const char *poldvalue, const char *pnewvalue, int *preturnstate);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
-
-// EOF
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
deleted file mode 100755
index 6dcf11a..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup MY 14 Platform Software Team
-/// \brief Internal Header for ns_config_parser_cfg.c
-///
-/// These functions are used to read from and write to cfg file.
-///
-///
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
-#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-// Include Files
-///////////////////////////////////////////////////////////////////////////////
-#include <ns_config_parser_internal.h>
-////////////////////////////////////////////////////////////////////////////////////////////
-/// CFGGetValue:
-/// Function : Traverse cfg file and read value corresponding to key.
-///
-/// \param [in] filePtr
-/// FILE * - filePtr is a Pointer to a file descriptor.
-/// \param [in] pKey
-/// const char * -pKey is a Pointer to user key.
-/// \param [in] pRetValue
-/// char * - pRetValue is a Pointer to value or values to be returned corresponding to user key.
-/// \return status
-/// int - value returned depending upon user provided Key is valid or not.\n
-/// returns 1 if user passed invalid key.\n
-/// returns 0 if user passed valid key.\n
-///
-///////////////////////////////////////////////////////////////////////////////////////////
-int CFGGetValue(FILE *file_ptr, const char *p_key, char *p_ret_value);
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// CFGUpdateOldValue:
-/// Function : Traverse the cfg file and update the value corresponding to given key.
-///
-/// \param [in] hConfigFile
-/// HANDLE - hConfigFile is a handle to given file.
-/// \param [in] pKey
-/// const char * - pKey is a Pointer to user key.
-/// \param [in] pValue
-/// const char * - pValue is a Pointer to new value corresponding to user key.
-/// \return status
-/// int - returns 1 if user passed invalid key.\n
-/// returns 0 if user passed valid key.\n
-/// returns -1 if memory allocation fail.\n
-/// returns -6 if value not updated in file.\n
-///
-///////////////////////////////////////////////////////////////////////////////////////////
-int CFGUpdateOldValue(HANDLE h_config_file, const char *p_key, const char *p_value);
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// CFGUpdateOldValueWithNewValue
-/// Function : Traverse the cfg file read value to given node,compare with old value,\n
-/// if old value matched then write new value in place of old value.\n
-///
-/// \param [in] hConfigFile
-/// HANDLE - hConfigFile is a handle to given file.
-/// \param [in] pKey
-/// const char * - pKey is a Pointer to user key.
-/// \param [in] pOldValue
-/// const char * - pOldValue is a Pointer to Old Value corresponding to user key.
-/// \param [in] pNewValue
-/// const char * - pNewValue is a Pointer to New Value corresponding to user key.
-/// \return status
-/// int - returns 1 if user passed invalid key.\n
-/// returns 0 if user passed valid key.\n
-/// returns -1 if memory allocation fail.\n
-/// returns -6 if value not updated in file.\n
-///
-///////////////////////////////////////////////////////////////////////////////////////////
-
-int CFGUpdateOldValueWithNewValue(HANDLE h_config_file, const char *p_key,
- const char *p_old_value, const char *p_new_value);
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_
-
-// EOF
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
deleted file mode 100755
index 97c9be6..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup MY 14 Platform Software Team
-/// \brief Internal Header for ns_config_parser_cfg.c
-///
-/// These structures are file handler structure.
-///
-///
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
-#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
-
-#include <libxml/tree.h>
-#include <ns_config_parser.h>
-
-
-// defines enum for MODE
-// in which file is opened
-typedef enum MODE {
- kReadMode = 0, kWriteMode, kAppend
-} MODE;
-
-// defines enum for STATUS
-typedef enum STATUS {
- kSuccess = 0, kFailure
-} STATUS;
-
-// defines enum for Filetype
-// i.e .cfg or .xml or other type of file
-typedef enum Filetype {
- kCfg = 0, kXml, kOther
-} Filetype;
-
-// FILE STRUCTURE
-typedef struct FILESTRUCT {
- char *filename;
- Filetype filetype;
- MODE mode;
- xmlDocPtr doc;
- FILE *fileptr;
-} FILESTRUCT;
-
-
-#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
deleted file mode 100755
index 0587489..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_ConfigParser
-/// \brief
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
-#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_logger_if.h>
-
-#define ZONE_INIT ZONEMASK(10)
-#define ZONE_FUNC ZONEMASK(11)
-#define ZONE_MEM ZONEMASK(12)
-#define ZONE_13 ZONEMASK(13)
-#define ZONE_14 ZONEMASK(14)
-#define ZONE_15 ZONEMASK(15)
-#define ZONE_16 ZONEMASK(16)
-#define ZONE_17 ZONEMASK(17)
-#define ZONE_18 ZONEMASK(18)
-#define ZONE_19 ZONEMASK(19)
-#define ZONE_20 ZONEMASK(20)
-#define ZONE_21 ZONEMASK(21)
-#define ZONE_22 ZONEMASK(22)
-#define ZONE_23 ZONEMASK(23)
-#define ZONE_24 ZONEMASK(24)
-#define ZONE_25 ZONEMASK(25)
-#define ZONE_26 ZONEMASK(26)
-#define ZONE_27 ZONEMASK(27)
-#define ZONE_28 ZONEMASK(28)
-#define ZONE_INFO ZONEMASK(29)
-#define ZONE_WARN ZONEMASK(30)
-#define ZONE_ERR ZONEMASK(31)
-
-#define ZONE_TEXT_10 "Init"
-#define ZONE_TEXT_11 "Function"
-#define ZONE_TEXT_12 "Memory"
-#define ZONE_TEXT_13 ""
-#define ZONE_TEXT_14 ""
-#define ZONE_TEXT_15 ""
-#define ZONE_TEXT_16 ""
-#define ZONE_TEXT_17 ""
-#define ZONE_TEXT_18 ""
-#define ZONE_TEXT_19 ""
-#define ZONE_TEXT_20 ""
-#define ZONE_TEXT_21 ""
-#define ZONE_TEXT_22 ""
-#define ZONE_TEXT_23 ""
-#define ZONE_TEXT_24 ""
-#define ZONE_TEXT_25 ""
-#define ZONE_TEXT_26 ""
-#define ZONE_TEXT_27 ""
-#define ZONE_TEXT_28 ""
-#define ZONE_TEXT_29 "Info"
-#define ZONE_TEXT_30 "Warning"
-#define ZONE_TEXT_31 "Error"
-
-#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
-#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT ) // LPRINT , LMSGQ, LSLOGGER
-#endif
-
-#ifndef FRAMEWORKUNIFIEDLOGZONES
-// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR)
-#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR)
-#endif
-
-extern const CHAR kAppName[];
-#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
deleted file mode 100755
index 9ec700c..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-######### installed program #############
-
-
-######### installed library(*.a) #############
-
-
-######### installed shared library(*.so) #############
-INST_SHLIBS = libNS_XMLConfigParser
-
-######### install headers(*.h) #############
-
-
-######### compiled sources #############
-libNS_XMLConfigParser_SRCS = ns_xml_reader.cpp ns_xml_writer.cpp ns_xmlparser.cpp ns_xmlparser_attributes.cpp ns_xmlparser_node.cpp
-
-######### add source path #############
-
-######### add include path #############
-
-CPPFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libxml2
-CPPFLAGS += -I../../../include
-CPPFLAGS += -I../include
-CPPFLAGS += -I../../../include
-#inc_dummy
-CPPFLAGS += -I../../../NS_ConfigParser/include
-
-######### add compile option #############
-CPPFLAGS += -DFRAMEWORKUNIFIEDLOGOPTIONS=0x08 -DFRAMEWORKUNIFIEDLOGAPPZONES=31,30,29,28,27,26,9,8,3
-
-######### add library path #############
-LDFLAGS += -L../../../
-LDFLAGS += -Wl,--no-as-needed
-######### linked library (dynamic) #############
-LDFLAGS += -Wl,--no-as-needed
-LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
-LDLIBS += -Wl,-Bdynamic -lxml2
-LDLIBS += -Wl,-Bdynamic -lm
-
-LINK_SHLIB_CXX = Y
-
-include ../../../../../native_service.mk
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001 b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
deleted file mode 100755
index cdf3238..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/makefile_PosixBasedOS001
+++ /dev/null
@@ -1,208 +0,0 @@
-#
-# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Standard Module Makefile version 2.0
-#
-
-# Name of the componet (team/domain prefix '_' component name)
-COMPONENT_NAME = NS_XMLConfigParser
-
-ifndef PRJ_ROOT
-export PRJ_ROOT = $(CURDIR)/../
-endif
-include $(PRJ_ROOT)cfg/depends.mk
-
-# Name of the componet (team/domain prefix '_' component name)
-# This must be the same as the RTC Component name and Eclipse Project Name
-COMPONENT_NAME = NS_XMLConfigParser
-
-
-# Additive Compile Flags (Flags from initiating make process will still apply)
-DEFS +=
-
-# Set local includes and then the reference includes (priority order determines search path)
-# Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
-# dependencies includes (other teams)
-# Local (current component references should be in the form of
-# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
-# Example your public include directory would be
-# $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
-# Team references should only be to other's public includes such as
-# $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
-# Global (non-team) references should be only to other's public includes such
-# these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
-INCLUDES = \
- $(CFG_INCS) \
- $(CC_IFLAG)./ \
- $(DEPENDS_INCLUDES) \
- $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
- $(CC_IFLAG)$(TEAM_ROOT)NS_ConfigParser/inc
-
-
-# Do the same if you need to include library paths as well
-# Do an incremental in case additional library paths are defined
-# at the top-level make. Use similar guidelines as for includes
-# for example to include a team component library it would be
-# $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
-LIB_PATHS += \
- $(DEPENDS_LIB_PATHS) \
-
-
-
-# Define binary outputs. These can be libraries or executables.
-# Name a variable for each deliverable. Suffixes should be
-# EXEC - For Executables -> output to the bin directory
-#TIME_EXEC = $(BIN_PATH)time
-# LIB - For Static Libraries -> output to lib directory with specific naming
-#MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
-# SLIB - For Shared Objects
-#FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
-# LIB - Define the static library for Message Queue
-#
-#
-ifdef DYNAMIC
- COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
-else
- COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
-endif
-
-
-## Sources Section
-
-# Define Library & Executable Sources (on a per deliverable basis)
-# This includes sources located in subdirectories.
-
-# Define generic line that pulls all c, cc, cpp files
-# since your in the src folder is pull only files from there
-COMPONENT_SRCS = \
- $(wildcard *.c) \
- $(wildcard *.cpp)
-
-# Define sources that my not be local to your component
-# here, you can define indivial files or wildcard from
-# a different folder.
-NON_LOCAL_SRCS = \
-
-
-# List of all sources to be built. Can be assembled from the other defintitions.
-# This only defines sources for the current directory, so if there are subdirectories
-# those are not included. (Those are found in simple subdirectory makefiles that only
-# direct the building of sources, but no linking into a binary)
-SOURCES = \
- $(COMPONENT_SRCS) \
- $(NON_LOCAL_SRCS) \
-
-
-
-#
-# Convert the source files to object files with correct folder location.
-#
-#
-C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
-CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
-
-
-# List of all sources to be generated. Can be assembled from the other defintitions.
-OBJECTS = \
- $(C_LANG_OBJECTS) \
- $(CPP_LANG_OBJECTS)
-
-
-
-# All headers that are dependencies. Wildcard is easy to pickup local headers.
-# This is only to automate the rebuilding, all builds on the servers are cleans
-# So this is not a huge deal when building on a component level.
-HEADERS = \
- $(wildcard *.h) \
- $(wildcard $(TEAM_ROOT)$(COMPONENT_NAME)/inc/*.h) \
- $(wildcard $(TEAM_ROOT)NativeServices/inc/*.h) \
- $(wildcard $(TEAM_ROOT)NativeServices/inc/native/*.h) \
-
-
-LIBRARIES = \
- $(COMPONENT_LIB) \
-
-DYNAMIC_LIBS += \
- xml2 \
- m
-
-# Make targets
-# Standard
-all: banner module_dirs subdirs local library binary
-
-debug:
- $(MAKE) TARGET=arm DEBUG=TRUE all
-
-base: banner module_dirs subdirs local
-
-# Standard Building of Source Files (Default builds for all objects defined above)
-$(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
- $(CC_CMD)
-
-$(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
- $(CPP_CMD)
-
-local: $(OBJECTS)
-
-# Defines specific for each deliverable
-
-# For a static library
-$(COMPONENT_LIB): $(OBJECTS)
-ifdef DYNAMIC
-# For a dynamic library
- $(SLIB_CMD)
- $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
- $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
- $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
-else
-# For a static library
- $(AR_CMD)
-endif
-
-# Standard set of derived targets
-library: base \
- $(LIBRARIES)
- @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
-
-binary: base \
- $(BINARIES)
-
-# Subdirs should be to jump to subdirectories
-# standard form is of
-# $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
-subdirs:
-
-clean:
- -rm -f $(BINARIES)
- -rm -f $(LIBRARIES)
- -rm -f $(OBJECTS)
- -rm -f $(COMPONENT_LIB).map
- -rm -f $(COMPONENT_LIB).debug
-
--v:
- @echo "objs: --> $(OBJECTS)"
- @echo "sources: --> $(SOURCES)"
- @echo "headers: --> $(HEADERS)"
- @echo "includes: --> $(INCLUDES)"
- @echo "lib paths: --> $(LIB_PATHS)"
- @echo "static libs: --> $(LD_STATIC_LIBS)"
- @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)"
- @echo "lib: --> $(LIBRARIES)"
- @echo "bin: --> $(BINARIES)"
-
-module_dirs: build_dirs
-
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
deleted file mode 100755
index 01abb97..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_reader.cpp
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_ConfigParser
-/// \brief This file contains implementation of CXMLReader class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_xml_reader.h>
-#include <string>
-#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-CXMLReader *GetCXMLReaderObject(CHAR *f_cfilepath) {
- CXMLReader *l_p_xml_reader = NULL;
- if (NULL != f_cfilepath) {
- l_p_xml_reader = new(std::nothrow) CXMLReader(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
- }
- return l_p_xml_reader;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-CXMLReader::CXMLReader(): m_pXmlDoc(NULL) {
-}
-
-CXMLReader::CXMLReader(const std::string &f_cFilePath): m_pXmlDoc(NULL) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
-
- // create document object structure
- m_pXmlDoc = xmlParseFile(f_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (!m_pXmlDoc) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-}
-
-CXMLReader::~CXMLReader() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
-
- if (NULL != m_pXmlDoc) {
- xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
- m_pXmlDoc = NULL;
- }
-}
-
-EFrameworkunifiedStatus CXMLReader::ParseFile(const std::string &f_cFilePath) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // create document object structure
- m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
-
- if (NULL == m_pXmlDoc) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-PVOID CXMLReader::GetDataPtr() {
- return m_pXmlDoc;
-}
-
-std::string CXMLReader::GetValue(const std::string &f_cKey) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
-
- std::string l_cValue = "";
-
- if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
- std::string l_cUserKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
- l_cUserKey.assign(f_cKey);
-
- // get the root node element
- xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (NULL != l_pCurrNode) {
- // remove the root node name from key
- size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (std::string::npos != l_uiLength) {
- l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
-
- // if root node name matches with the name in received key
- if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
- l_cValue = XMLGetValue(l_pCurrNode,
- l_cUserKey);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", l_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
-
- return l_cValue;
-}
-
-std::string CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode,
- const std::string &f_cUserKey) {
- std::string l_cReturnValue = "";
-
- if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
- std::string l_cKey = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // result of previous attribute of same node
- BOOL l_bResult = TRUE;
-
- // this parameter specifies whether to AND or OR the current result with previous result
- // TRUE means AND while FALSE means OR
- BOOL l_bOperation = FALSE;
-
- // position of "@" in user key if exists
- size_t l_uiAttrLen = 0;
-
- // get the single attribute from list of attributes of node
- std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
- std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // contains the single attribute key, value
- std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // l_cAttrId of the attribute
- std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
- // value of the attribute
- std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- size_t l_uiSplitProp = 0;
- size_t l_uiAttrSplit = 0;
- BOOL l_bCurrentResult = FALSE;
-
- l_cKey.assign(f_cUserKey);
-
- // position of first "." in user key
- size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
- if (std::string::npos != l_uiLength) {
- // get the current node name string with node attributes
- l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- l_cNodeName.assign(l_cKey);
-
- // get children of current node
- f_pCurrNode = f_pCurrNode->children;
-
- while (NULL != f_pCurrNode) {
- // check whether current node is an element node.
- if (XML_ELEMENT_NODE == f_pCurrNode->type) {
- l_bResult = TRUE;
- l_bOperation = FALSE;
- l_uiAttrLen = 0;
- l_cAttr.clear();
-
- // check whether key contains attribute for current node
- if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
- // get the attribute string from node key
- l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
-
- // remove the attribute string from key string
- l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // check whether node name string matches with the current node name
- if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
- l_cAttrOpt.assign(l_cAttr);
-
- while (0 < l_cAttr.length()) {
- // initialize variables
- l_cAttrId.clear();
- l_cAttrValue.clear();
- l_uiSplitProp = 0;
- l_uiAttrSplit = 0;
- l_bCurrentResult = FALSE;
-
- // check whether node have multiple attributes
- if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else {
- l_uiSplitProp = l_cAttr.length() - 1;
- if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
- l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
- l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
-
- // compare the value of attributes
- xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
- if (NULL != l_pAttrValue) {
- if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
- l_bCurrentResult = TRUE;
- }
- }
- xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
- l_pAttrValue = NULL;
-
- // combine the result of all attributes
- if (!l_bOperation) {
- l_bResult = l_bResult && l_bCurrentResult;
- } else {
- l_bResult = l_bResult || l_bCurrentResult;
- }
-
- if ('|' == l_cAttr[l_uiSplitProp]) {
- l_bOperation = TRUE;
- } else {
- l_bOperation = FALSE;
- }
-
- if ((!l_bResult) && (!l_bOperation)) {
- // break from current while loop
- break;
- }
-
- l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // if attributes not matched move to next node
- if (!l_bResult) {
- // search for the same node name in next child nodes
- l_cKey.assign(l_cNodeName);
- } else {
- // read text of current node
- if ((NULL != f_pCurrNode->children) &&
- (XML_TEXT_NODE == f_pCurrNode->children->type) &&
- (NULL == f_pCurrNode->children->next)) {
- // append the result in string
- l_cReturnValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
- } else {
- l_bResult = FALSE;
- }
-
- if (l_bResult) {
- // parse children and next nodes of current node
- if (std::string::npos != l_uiLength) {
- l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
-
- std::string l_cValue = XMLGetValue(f_pCurrNode, l_cKey); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (!l_cReturnValue.empty() && !l_cValue.empty()) {
- l_cReturnValue.append("\n");
- }
-
- // append the received string
- l_cReturnValue.append(l_cValue);
- }
-
- l_cKey = l_cNodeName;
- }
- }
-
- f_pCurrNode = f_pCurrNode->next;
- }
- }
-
- return l_cReturnValue;
-}
-
-EFrameworkunifiedStatus CXMLReader::GetValue(const std::string &f_cKey, std::string &f_cValue) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key is %s", f_cKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- std::string l_cUserKey = "";
- l_cUserKey.assign(f_cKey);
-
- // get the root node element
- xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
-
- if (NULL != l_pCurrNode) {
- // remove the root node name from key
- size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (std::string::npos != l_uiLength) {
- l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
-
- // if root node name matches with the name in received key
- if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
- BOOL l_bKeyFound = FALSE;
-
- XMLGetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
-
- if (!l_bKeyFound) {
- l_eStatus = eFrameworkunifiedStatusFail;
- }
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Root Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Parsed Value :: %s", f_cValue.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-EFrameworkunifiedStatus CXMLReader::XMLGetValue(xmlNodePtr f_pCurrNode, const std::string &f_cUserKey, std::string &f_cValue,
- BOOL &f_bKeyFound) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_pCurrNode && (!f_cUserKey.empty())) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- std::string l_cKey = "";
-
- // result of previous attribute of same node
- BOOL l_bResult = TRUE;
-
- // this parameter specifies whether to AND or OR the current result with previous result
- // TRUE means AND while FALSE means OR
- BOOL l_bOperation = FALSE;
-
- // position of "@" in user key if exists
- size_t l_uiAttrLen = 0;
-
- // get the single attribute from list of attributes of node
- std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
- std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // contains the single attribute key, value
- std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // l_cAttrId of the attribute
- std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
- // value of the attribute
- std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- size_t l_uiSplitProp = 0;
- size_t l_uiAttrSplit = 0;
- BOOL l_bCurrentResult = FALSE;
-
- l_cKey.assign(f_cUserKey);
-
- // position of first "." in user key
- size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
- if (std::string::npos != l_uiLength) {
- // get the current node name string with node attributes
- l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
- }
- l_cNodeName.assign(l_cKey);
-
- // get children of current node
- f_pCurrNode = f_pCurrNode->children;
-
- while (NULL != f_pCurrNode) {
- // check whether current node is an element node.
- if (XML_ELEMENT_NODE == f_pCurrNode->type) {
- l_bResult = TRUE;
- l_bOperation = FALSE;
- l_uiAttrLen = 0;
- l_cAttr.clear();
-
- // check whether key contains attribute for current node
- if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
- // get the attribute string from node key
- l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
-
- // remove the attribute string from key string
- l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // check whether node name string matches with the current node name
- if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
- l_cAttrOpt.assign(l_cAttr);
-
- while (0 < l_cAttr.length()) {
- // initialize variables
- l_cAttrId.clear();
- l_cAttrValue.clear();
- l_uiSplitProp = 0;
- l_uiAttrSplit = 0;
- l_bCurrentResult = FALSE;
-
- // check whether node have multiple attributes
- if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else {
- l_uiSplitProp = l_cAttr.length() - 1;
- if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
- l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
- l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
-
- // compare the value of attributes
- xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
- if (NULL != l_pAttrValue) {
- if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
- l_bCurrentResult = TRUE;
- }
-
- xmlFree(l_pAttrValue); // LCOV_EXCL_BR_LINE 11: except branch
- l_pAttrValue = NULL;
- }
-
- // combine the result of all attributes
- if (!l_bOperation) {
- l_bResult = l_bResult && l_bCurrentResult;
- } else {
- l_bResult = l_bResult || l_bCurrentResult;
- }
-
- if ('|' == l_cAttr[l_uiSplitProp]) {
- l_bOperation = TRUE;
- } else {
- l_bOperation = FALSE;
- }
-
- if ((!l_bResult) && (!l_bOperation)) {
- // break from current while loop
- break;
- }
-
- l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // if attributes not matched move to next node
- if (!l_bResult) {
- // search for the same node name in next child nodes
- l_cKey.assign(l_cNodeName);
- } else {
- // read text of current node
- if ((NULL != f_pCurrNode->children) &&
- (XML_TEXT_NODE == f_pCurrNode->children->type) &&
- (NULL == f_pCurrNode->children->next)) {
- if (!f_cValue.empty()) {
- f_cValue.append("\n");
- }
-
- // append the result in string
- f_cValue.append((PCSTR) f_pCurrNode->children->content); // LCOV_EXCL_BR_LINE 11: except branch
-
- f_bKeyFound = TRUE;
- }
- }
- } else {
- l_bResult = FALSE;
- }
-
- if (l_bResult) {
- // parse children and next nodes of current node
- if (std::string::npos != l_uiLength) {
- l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
-
- l_eStatus = XMLGetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
- }
-
- l_cKey = l_cNodeName;
- }
- }
-
- f_pCurrNode = f_pCurrNode->next;
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
deleted file mode 100755
index 2876e22..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xml_writer.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_ConfigParser
-/// \brief This file contains implementation of CXMLWriter class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_xml_writer.h>
-#include <string>
-#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-CXMLWriter *GetCXMLWriterObject(CHAR *f_cfilepath) {
- CXMLWriter *l_p_xml_writer = NULL;
- if (NULL != f_cfilepath) {
- l_p_xml_writer = new(std::nothrow) CXMLWriter(f_cfilepath); // LCOV_EXCL_BR_LINE 11: except branch
- }
- return l_p_xml_writer;
-}
-
-CXMLWriter *GetCXMLWriterObjectNoParam() {
- return (new(std::nothrow) CXMLWriter()); // LCOV_EXCL_BR_LINE 11: except branch
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-CXMLWriter::CXMLWriter(): m_pXmlDoc(NULL), m_cFilePath("") {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-}
-
-CXMLWriter::CXMLWriter(const std::string &f_cFilePath): m_pXmlDoc(NULL), m_cFilePath(f_cFilePath) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "File Path %s", f_cFilePath.c_str());
-
- // create document object structure
- m_pXmlDoc = xmlParseFile(m_cFilePath.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (!m_pXmlDoc) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
- }
-}
-
-CXMLWriter::~CXMLWriter() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Destructor");
-
- if (NULL != m_pXmlDoc) {
- xmlFreeDoc(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
- m_pXmlDoc = NULL;
- }
-}
-
-EFrameworkunifiedStatus CXMLWriter::ParseFile(const std::string &f_cFilePath) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- l_eStatus = SetPath(f_cFilePath);
-
- if (NULL != m_pXmlDoc) {
- xmlFreeDoc(m_pXmlDoc);
- m_pXmlDoc = NULL;
- }
-
- // create document object structure
- m_pXmlDoc = xmlParseFile(f_cFilePath.c_str());
-
- if (NULL == m_pXmlDoc) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Pointer to document structure is NULL");
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-EFrameworkunifiedStatus CXMLWriter::SetPath(const std::string &f_cPath) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (!f_cPath.empty()) {
- // set the file path
- m_cFilePath.assign(f_cPath);
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- }
-
- return l_eStatus;
-}
-
-VOID CXMLWriter::SetDataPtr(PVOID f_pData) {
- m_pXmlDoc = NULL;
- if (NULL != f_pData) {
- // set the doc pointer
- m_pXmlDoc = static_cast<xmlDocPtr>(f_pData);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Data Pointer not set in xml writer"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-}
-
-EFrameworkunifiedStatus CXMLWriter::SetValue(const std::string &f_cKey, std::string f_cValue) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Key %s", f_cKey.c_str());
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (NULL != m_pXmlDoc && (!f_cKey.empty())) {
- std::string l_cUserKey = "";
- l_cUserKey.assign(f_cKey);
-
- // get the root node element
- xmlNodePtr l_pCurrNode = xmlDocGetRootElement(m_pXmlDoc);
-
- if (NULL != l_pCurrNode) {
- // remove the root node name from key
- size_t l_uiLength = l_cUserKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (std::string::npos != l_uiLength) {
- l_cUserKey = l_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
-
- // if root node name matches with the name in received key
- if (!(f_cKey.substr(0, l_uiLength)).compare((PCSTR)l_pCurrNode->name)) {
- BOOL l_bKeyFound = FALSE;
- l_eStatus = XMLSetValue(l_pCurrNode, l_cUserKey, f_cValue, l_bKeyFound);
-
- if (!l_bKeyFound) {
- l_eStatus = eFrameworkunifiedStatusFail;
- }
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document structure pointer m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- }
-
- return l_eStatus;
-}
-
-EFrameworkunifiedStatus CXMLWriter::XMLSetValue(xmlNodePtr f_pCurrNode,
- const std::string &f_cUserKey,
- std::string &f_cValue,
- BOOL &f_bKeyFound) {
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (!f_cUserKey.empty() && NULL != f_pCurrNode) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Key :: %s", f_cUserKey.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- std::string l_cKey = "";
-
- // result of previous attribute of same node
- BOOL l_bResult = TRUE;
-
- // this parameter specifies whether to AND or OR the current result with previous result
- // TRUE means AND while FALSE means OR
- BOOL l_bOperation = FALSE;
-
- // position of "@" in user key if exists
- size_t l_uiAttrLen = 0;
-
- // get the single attribute from list of attributes of node
- std::string l_cAttr = ""; // LCOV_EXCL_BR_LINE 11: except branch
- std::string l_cNodeName = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // contains the single attribute key, value
- std::string l_cAttrOpt = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- // l_cAttrId of the attribute
- std::string l_cAttrId = ""; // LCOV_EXCL_BR_LINE 11: except branch
- // value of the attribute
- std::string l_cAttrValue = ""; // LCOV_EXCL_BR_LINE 11: except branch
-
- size_t l_uiSplitProp = 0;
- size_t l_uiAttrSplit = 0;
- BOOL l_bCurrentResult = FALSE;
-
- l_cKey.assign(f_cUserKey);
-
- // position of first "." in user key
- size_t l_uiLength = l_cKey.find('.'); // LCOV_EXCL_BR_LINE 11: except branch
- if (std::string::npos != l_uiLength) {
- // get the current node name string with node attributes
- l_cKey = l_cKey.substr(0, l_uiLength); // LCOV_EXCL_BR_LINE 11: except branch
-
- l_cNodeName.assign(l_cKey);
- }
-
- // get children of current node
- f_pCurrNode = f_pCurrNode->children;
-
- while (NULL != f_pCurrNode) {
- // check whether current node is an element node.
- if (XML_ELEMENT_NODE == f_pCurrNode->type) {
- l_bResult = TRUE;
- l_bOperation = FALSE;
- l_uiAttrLen = 0;
- l_cAttr.clear();
-
- // check whether key contains attribute for current node
- if (std::string::npos != (l_uiAttrLen = l_cKey.find('@'))) {
- // get the attribute string from node key
- l_cAttr.assign(l_cKey, (l_uiAttrLen + 1), std::string::npos); // LCOV_EXCL_BR_LINE 11: except branch
-
- // remove the attribute string from key string
- l_cKey = l_cKey.substr(0, l_uiAttrLen); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // check whether node name string matches with the current node name
- if (!l_cKey.compare((PCSTR)f_pCurrNode->name)) {
- l_cAttrOpt.assign(l_cAttr);
-
- while (0 < l_cAttr.length()) {
- // initialize variables
- l_cAttrId.clear();
- l_cAttrValue.clear();
- l_uiSplitProp = 0;
- l_uiAttrSplit = 0;
- l_bCurrentResult = FALSE;
-
- // check whether node have multiple attributes
- if (std::string::npos != (l_uiSplitProp = l_cAttr.find('|'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else if (std::string::npos != (l_uiSplitProp = l_cAttr.find('&'))) {
- l_cAttrOpt = l_cAttr.substr(0, l_uiSplitProp);
-
- if (std::string::npos != (l_uiAttrSplit = l_cAttrOpt.find('='))) {
- l_cAttrId = l_cAttrOpt.substr(0, l_uiAttrSplit);
- l_cAttrValue = l_cAttrOpt.substr(l_uiAttrSplit + 1);
- }
- } else {
- l_uiSplitProp = l_cAttr.length() - 1;
- if (std::string::npos != (l_uiAttrSplit = l_cAttr.find('='))) {
- l_cAttrId = l_cAttr.substr(0, l_uiAttrSplit); // LCOV_EXCL_BR_LINE 11: except branch
- l_cAttrValue = l_cAttr.substr(l_uiAttrSplit + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
-
- // compare the value of attributes
- xmlChar *l_pAttrValue = xmlGetProp(f_pCurrNode, (const xmlChar *)l_cAttrId.c_str()); // LCOV_EXCL_BR_LINE 11: except branch
- if (NULL != l_pAttrValue) {
- if (!l_cAttrValue.compare((PCSTR)l_pAttrValue)) {
- l_bCurrentResult = TRUE;
- }
- }
- xmlFree(l_pAttrValue);
- l_pAttrValue = NULL;
-
- // combine the result of all attributes
- if (!l_bOperation) {
- l_bResult = l_bResult && l_bCurrentResult;
- } else {
- l_bResult = l_bResult || l_bCurrentResult;
- }
-
- if ('|' == l_cAttr[l_uiSplitProp]) {
- l_bOperation = TRUE;
- } else {
- l_bOperation = FALSE;
- }
-
- if ((!l_bResult) && (!l_bOperation)) {
- // break from current while loop
- break;
- }
-
- l_cAttr = l_cAttr.substr(l_uiSplitProp + 1); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- // if attributes not matched move to next node
- if (!l_bResult) {
- // search for the same node name in next child nodes
- l_cKey.assign(l_cNodeName);
- } else {
- // read text of current node
- if ((NULL != f_pCurrNode->children) &&
- (XML_TEXT_NODE == f_pCurrNode->children->type) &&
- (NULL == f_pCurrNode->children->next)) {
- // set the value
- xmlNodeSetContent(f_pCurrNode, (const xmlChar *)f_cValue.c_str());
-
- f_bKeyFound = TRUE;
- }
- }
- }
-
- if (l_bResult) {
- // parse children and next nodes of current node
- l_cKey = f_cUserKey.substr(l_uiLength + 1); // LCOV_EXCL_BR_LINE 11: except branch
- l_eStatus = XMLSetValue(f_pCurrNode, l_cKey, f_cValue, f_bKeyFound);
- }
- }
-
- f_pCurrNode = f_pCurrNode->next;
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- return l_eStatus;
-}
-
-EFrameworkunifiedStatus CXMLWriter::SaveData() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- // save the doc structure to the file
- if (-1 == xmlSaveFileEnc(m_cFilePath.c_str(), m_pXmlDoc, "UTF-8")) {
- l_eStatus = eFrameworkunifiedStatusFail;
- }
-
- return l_eStatus;
-}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
deleted file mode 100755
index cb05865..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_XmlParser
-/// \brief This file contains implementation of CXmlParser class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_xmlparser_if.h>
-#include <fstream>
-#include <string>
-#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CXmlParser
-/// Constructor
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlParser::CXmlParser(): m_pXmlDoc(NULL), m_cFileName(""), m_pRootNode(NULL) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // for maintaining indentation
- xmlKeepBlanksDefault(0); // LCOV_EXCL_BR_LINE 11: except branch
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CXmlParser
-/// Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlParser::~CXmlParser() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // clears the document structure
- ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ParseXml
-/// Parses the xml file and creates a document structure
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlParser::ParseXml(std::string f_cFileName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- // clears the document structure
- ClearDocument(); // LCOV_EXCL_BR_LINE 11: except branch
-
- m_cFileName = f_cFileName;
-
- if (IsReadable(m_cFileName)) {
- // create document object structure
- m_pXmlDoc = xmlParseFile(m_cFileName.c_str());
-
- if (NULL != m_pXmlDoc) {
- // sets the root node in class
- m_pRootNode.SetXmlNodePtr(xmlDocGetRootElement(m_pXmlDoc));
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Document not parsed successfully :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateNewXmlDoc
-/// Creates a new xml document with f_cRootNodeName as root node
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlParser::CreateNewXmlDoc(std::string f_cRootNodeName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- xmlNodePtr l_pRootNodePtr = NULL;
-
- // clears the document structure
- ClearDocument();
-
- if (0 < f_cRootNodeName.length()) {
- // creates new document structure
- m_pXmlDoc = xmlNewDoc((const xmlChar *)"1.0");
- if (NULL != m_pXmlDoc) {
- // create new node(root)
- l_pRootNodePtr = xmlNewNode(NULL,
- (const xmlChar *)f_cRootNodeName.c_str());
- if (NULL != l_pRootNodePtr) {
- // sets the root node in document structure
- xmlDocSetRootElement(m_pXmlDoc, l_pRootNodePtr);
-
- // sets the root node in class
- m_pRootNode.SetXmlNodePtr(l_pRootNodePtr);
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating new root node"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to create new xml document structure"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid root node name :: %s", f_cRootNodeName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SaveXml
-/// Saves the document structure in an xml file
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlParser::SaveXml(std::string f_cFileName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
- std::string l_cFileName = "";
-
- // if user explicitly provides file name
- if (0 < f_cFileName.length()) {
- l_cFileName.assign(f_cFileName);
- } else { // takes the file name from the CXmlParser object
- l_cFileName.assign(m_cFileName);
- }
-
- if (NULL != m_pXmlDoc) {
- if (IsReadable(l_cFileName)) {
- // save the doc structure to the file
- if (-1 == xmlSaveFormatFileEnc(l_cFileName.c_str(), m_pXmlDoc, "UTF-8", 1)) {
- l_eStatus = eFrameworkunifiedStatusFail;
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusInvldParam;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "File not exists :: %s", f_cFileName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "m_pXmlDoc is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetRootNode
-/// Gets the root node object of xml
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlParser::GetRootNode() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_pRootNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddNewNode
-/// Adds the new node to the parent node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlParser::AddNewNode(CXmlNode m_pParentNode, std::string f_cNewNodeName, std::string f_cContent) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (!m_pParentNode.IsNull()) {
- l_pXmlNode = m_pParentNode.AddChildNode(f_cNewNodeName, f_cContent); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveNode
-/// Removes the node from the xml
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlParser::RemoveNode(CXmlNode m_pNode) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (!m_pNode.IsNull()) {
- xmlUnlinkNode(m_pNode.m_pXmlNodePtr);
- xmlFreeNode(m_pNode.m_pXmlNodePtr);
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FindNode
-/// Finds the first matching node, by tag name or path
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlParser::FindNode(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (NULL != l_pXpathObj) {
- if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
- l_pXmlNode.SetXmlNodePtr(l_pXpathObj->nodesetval->nodeTab[0]); // LCOV_EXCL_BR_LINE 11: except branch
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FindAllNodes
-/// Finds all the matching node, by tag name or path
-////////////////////////////////////////////////////////////////////////////////////////////////
-TNodeList CXmlParser::FindAllNodes(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- TNodeList l_pNodeList;
-
- xmlXPathObjectPtr l_pXpathObj = GetNodeSet(f_cNodePath, f_pCurrentNode); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (NULL != l_pXpathObj) {
- if (NULL != l_pXpathObj->nodesetval && 0 < l_pXpathObj->nodesetval->nodeNr) {
- for (UI_8 l_uiSize = 0;
- l_uiSize < l_pXpathObj->nodesetval->nodeNr;
- l_uiSize++) {
- if (NULL != l_pXpathObj->nodesetval->nodeTab[l_uiSize]) {
- CXmlNode l_pNode(l_pXpathObj->nodesetval->nodeTab[l_uiSize]); // LCOV_EXCL_BR_LINE 11: except branch
- l_pNodeList.push_back(l_pNode);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "node pointer is NULL");
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NodeSetVal is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- xmlXPathFreeObject(l_pXpathObj); // LCOV_EXCL_BR_LINE 11: except branch
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "xmlXPathObjectPtr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNodeList;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetNodeSet
-/// Gets the node set resulting from search of nodepath using XPath
-////////////////////////////////////////////////////////////////////////////////////////////////
-xmlXPathObjectPtr CXmlParser::GetNodeSet(std::string f_cNodePath, CXmlNode f_pCurrentNode) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- xmlXPathObjectPtr l_pXpathObj = NULL;
-
- xmlXPathContextPtr l_pXpathCtx = NULL;
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlDoc) {
- if (!f_pCurrentNode.IsNull()) {
- l_pXmlNode = f_pCurrentNode;
- }
-
- // Create xpath evaluation context
- l_pXpathCtx = xmlXPathNewContext(m_pXmlDoc); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (NULL != l_pXpathCtx) {
- // set the current node in path context
- l_pXpathCtx->node = l_pXmlNode.m_pXmlNodePtr;
-
- // Evaluate xpath expression
- l_pXpathObj = xmlXPathEvalExpression((const xmlChar *)f_cNodePath.c_str(), l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
-
- if (NULL == l_pXpathObj) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to evaluate nodepath :: \"%s\"", f_cNodePath.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- // Cleanup of XPath data
- xmlXPathFreeContext(l_pXpathCtx); // LCOV_EXCL_BR_LINE 11: except branch
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create new XPath context"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "document object is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXpathObj;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ClearDocument
-/// Clears the document structure and resets the root node
-////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CXmlParser::ClearDocument() {
- if (NULL != m_pXmlDoc) {
- // free the document
- xmlFreeDoc(m_pXmlDoc);
- m_pXmlDoc = NULL;
-
- // free the global variables that may have been allocated by the parser
- xmlCleanupParser();
- }
-
- m_pRootNode = NULL;
- m_cFileName.clear();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsReadable
-/// Checks whether the file exists or not
-////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CXmlParser::IsReadable(const std::string &filename) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- BOOL l_bReadable = FALSE;
-
- std::ifstream l_ifstream(filename.c_str());
-
- if (l_ifstream.good()) {
- l_bReadable = TRUE;
- l_ifstream.close(); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bReadable;
-}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
deleted file mode 100755
index 27b6bad..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_attributes.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_XmlParser
-/// \brief This file contains implementation of CXmlAttr class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_xmlparser_if.h>
-#include <string>
-#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CXmlAttr
-/// Constructor of CXmlAttr class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlAttr::CXmlAttr(): m_cKey(""), m_cValue("") {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CXmlAttr
-/// Parameterized constructor of CXmlAttr class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlAttr::CXmlAttr(std::string f_cKey, std::string f_cValue): m_cKey(f_cKey), m_cValue(f_cValue) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CXmlAttr
-/// Destructor of CXmlAttr class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlAttr::~CXmlAttr() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
diff --git a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp b/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
deleted file mode 100755
index 47f6caa..0000000
--- a/nsframework/framework_unified/client/NS_XMLConfigeParser/library/src/ns_xmlparser_node.cpp
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \ingroup tag_NS_XmlParser
-/// \brief This file contains implementation of CXmlNode class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_xmlparser_if.h>
-#include <string>
-#include "ns_xmlconfig_parser_frameworkunifiedlog.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CXmlNode
-/// Constructor
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode::CXmlNode(): m_pXmlNodePtr(NULL) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CXmlNode
-/// Parameterized Constructor
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode::CXmlNode(xmlNodePtr f_pXmlNodePtr): m_pXmlNodePtr(f_pXmlNodePtr) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CXmlNode
-/// Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode::~CXmlNode() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetXmlNodePtr
-/// Sets the xmlNodePtr in class
-////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CXmlNode::SetXmlNodePtr(xmlNodePtr f_pXmlNodePtr) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- m_pXmlNodePtr = f_pXmlNodePtr;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsNull
-/// Checks whether the node is valid or not
-////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CXmlNode::IsNull() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- BOOL l_bNull = FALSE;
-
- if (NULL == m_pXmlNodePtr) {
- l_bNull = TRUE;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bNull;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// Type
-/// Gets the type of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedXmlNodeTypes CXmlNode::Type() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedXmlNodeTypes l_eNodeType = FRAMEWORKUNIFIED_XML_NODE_NONE;
-
- if (NULL != m_pXmlNodePtr) {
- switch (m_pXmlNodePtr->type) {
- case XML_ELEMENT_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_NODE;
- break;
- case XML_ATTRIBUTE_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_NODE;
- break;
- case XML_TEXT_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_TEXT_NODE;
- break;
- case XML_CDATA_SECTION_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_CDATA_SECTION_NODE;
- break;
- case XML_ENTITY_REF_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_REF_NODE;
- break;
- case XML_ENTITY_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_NODE;
- break;
- case XML_PI_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_PI_NODE;
- break;
- case XML_COMMENT_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_COMMENT_NODE;
- break;
- case XML_DOCUMENT_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_NODE;
- break;
- case XML_DOCUMENT_TYPE_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_TYPE_NODE;
- break;
- case XML_DOCUMENT_FRAG_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_DOCUMENT_FRAG_NODE;
- break;
- case XML_NOTATION_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_NOTATION_NODE;
- break;
- case XML_HTML_DOCUMENT_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_HTML_DOCUMENT_NODE;
- break;
- case XML_DTD_NODE:
- l_eNodeType = FRAMEWORKUNIFIED_XML_DTD_NODE;
- break;
- case XML_ELEMENT_DECL:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ELEMENT_DECL;
- break;
- case XML_ATTRIBUTE_DECL:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ATTRIBUTE_DECL;
- break;
- case XML_ENTITY_DECL:
- l_eNodeType = FRAMEWORKUNIFIED_XML_ENTITY_DECL;
- break;
- case XML_NAMESPACE_DECL:
- l_eNodeType = FRAMEWORKUNIFIED_XML_NAMESPACE_DECL;
- break;
- case XML_XINCLUDE_START:
- l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_START;
- break;
- case XML_XINCLUDE_END:
- l_eNodeType = FRAMEWORKUNIFIED_XML_XINCLUDE_END;
- break;
- default:
- break;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eNodeType;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// Name
-/// Gets the name of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-std::string CXmlNode::Name() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- std::string l_cNodeName = "";
-
- if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->name) {
- l_cNodeName = std::string((PCSTR)m_pXmlNodePtr->name); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_cNodeName;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetContent
-/// Gets the content of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-std::string CXmlNode::GetContent() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- std::string l_cText = "";
-
- if ((NULL != m_pXmlNodePtr) &&
- (NULL != m_pXmlNodePtr->children) &&
- (XML_TEXT_NODE == m_pXmlNodePtr->children->type) &&
- (NULL == m_pXmlNodePtr->children->next)) {
- xmlChar * p_xmlText = xmlNodeGetContent(m_pXmlNodePtr);
- l_cText = std::string((PCSTR)p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
- xmlFree(p_xmlText); // LCOV_EXCL_BR_LINE 11: except branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_cText;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetContent
-/// Sets or updates the content of current node.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::SetContent(std::string f_cUpdatedText) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (NULL != m_pXmlNodePtr) {
- xmlNodeSetContent(m_pXmlNodePtr, (const xmlChar *)f_cUpdatedText.c_str());
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetAttributeValue
-/// Gets the attribute's value for the key.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::GetAttributeValue(std::string f_cKey, std::string &f_cAttributeValue) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (NULL != m_pXmlNodePtr) {
- xmlChar *l_pAttrValue = xmlGetProp(m_pXmlNodePtr,
- (const xmlChar *)f_cKey.c_str());
- if (NULL != l_pAttrValue) {
- f_cAttributeValue.assign((PCSTR)l_pAttrValue);
-
- xmlFree(l_pAttrValue);
- l_pAttrValue = NULL;
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Attribute key :: %s not found", f_cKey.c_str());
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetAttributeValue
-/// Sets the attribute's value for the key
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::SetAttributeValue(std::string f_cKey, std::string f_cValue) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "SetAttributeValue feature is not available,"
- "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddNewAttribute
-/// Add new attribute to the node
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::AddNewAttribute(std::string f_cKey, std::string f_cAttributeValue) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
- xmlChar* p_key = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cKey.c_str()));
- xmlChar* p_value = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cAttributeValue.c_str()));
- if (NULL != m_pXmlNodePtr) {
- if (NULL == xmlNewNsProp(m_pXmlNodePtr,
- NULL,
- p_key,
- p_value)) {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Unable to add new property :: %s", f_cKey.c_str());
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Node ptr is NULL"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveAttribute
-/// Removes the attribute from the node with the specified key
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::RemoveAttribute(std::string f_cKey) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- FRAMEWORKUNIFIEDLOG(ZONE_NS_WAR, __FUNCTION__, "RemoveAttribute feature is not available,"
- "Reason: This API is not supported by libxml2 present in PosixBasedOS001"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetAttributeItems
-/// Gets the list of all the attribute's key and value of the node
-////////////////////////////////////////////////////////////////////////////////////////////////
-TAttrList CXmlNode::GetAttributeItems() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- TAttrList l_cAttrList;
- std::string l_cKey;
- std::string l_cValue;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlAttrPtr l_pAttr = m_pXmlNodePtr->properties;
- l_pAttr != NULL;
- l_pAttr = l_pAttr->next) {
- l_cKey = (PCSTR)l_pAttr->name;
- l_cValue = "";
-
- if (NULL != l_pAttr->children) {
- l_cValue = (PCSTR)l_pAttr->children->content;
- }
-
- CXmlAttr l_pXmlAttr(l_cKey, l_cValue);
- l_cAttrList.push_back(l_pXmlAttr); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_cAttrList;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// Parent
-/// Gets the parent node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::Parent() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr && NULL != m_pXmlNodePtr->parent) {
- if (XML_ELEMENT_NODE == m_pXmlNodePtr->parent->type) {
- l_pXmlNode.SetXmlNodePtr(m_pXmlNodePtr->parent); // LCOV_EXCL_BR_LINE 11: except branch
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FirstChild
-/// Gets the first child of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::FirstChild() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->next) {
- if (XML_ELEMENT_NODE == l_pNodePtr->type) {
- l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// LastChild
-/// Gets the last child of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::LastChild() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->last;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->prev) {
- if (XML_ELEMENT_NODE == l_pNodePtr->type) {
- l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// Children
-/// Gets the list of all the child node of current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-TNodeList CXmlNode::Children() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- TNodeList l_pNodeList;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->next) {
- if (XML_ELEMENT_NODE == l_pNodePtr->type) {
- CXmlNode l_pXmlNode(l_pNodePtr);
- l_pNodeList.push_back(l_pXmlNode);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNodeList;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NextSibling
-/// Gets the next sibling node of current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::NextSibling() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->next;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->next) {
- if (XML_ELEMENT_NODE == l_pNodePtr->type) {
- l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// PrevSibling
-/// Gets the previous sibling node of current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::PrevSibling() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->prev;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->prev) {
- if (XML_ELEMENT_NODE == l_pNodePtr->type) {
- l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FindChildNode
-/// Finds the first immediate sub node matching tag as f_cNodeName.
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::FindChildNode(std::string f_cNodeName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- CXmlNode l_pXmlNode;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->next) {
- if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
- (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
- l_pXmlNode.SetXmlNodePtr(l_pNodePtr); // LCOV_EXCL_BR_LINE 11: except branch
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pXmlNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FindAllChildNodes
-/// Gets the list of all the immediate sub node matching tag as f_cNodeName.
-////////////////////////////////////////////////////////////////////////////////////////////////
-TNodeList CXmlNode::FindAllChildNodes(std::string f_cNodeName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- TNodeList l_pNodeList;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pNodePtr = m_pXmlNodePtr->children;
- l_pNodePtr != NULL;
- l_pNodePtr = l_pNodePtr->next) {
- if ((XML_ELEMENT_NODE == m_pXmlNodePtr->type) &&
- (0 == f_cNodeName.compare((PCSTR)l_pNodePtr->name))) {
- CXmlNode l_pXmlNode(l_pNodePtr);
- l_pNodeList.push_back(l_pXmlNode);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNodeList;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetContentOfChildNode
-/// Finds the first level sub node matching tag as f_cNodeName.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::GetContentOfChildNode(std::string f_cNodeName, std::string &f_cContent) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
-
- if (!l_pXmlNode.IsNull()) {
- f_cContent.assign(l_pXmlNode.GetContent());
- } else {
- l_eStatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddChildNode
-/// Adds sub node to the current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::AddChildNode(std::string f_cNodeName, std::string f_cText) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // pointer of child node
- xmlNodePtr l_pChildNode = NULL;
-
- // content of child node
- xmlChar *l_cNodeContent = NULL;
-
- // validate the node name
- if (NULL != m_pXmlNodePtr && 0 < f_cNodeName.length()) {
- if (0 < f_cText.length()) {
- xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
- l_cNodeContent = p_text;
- }
-
- if (NULL == (l_pChildNode = xmlNewDocNode(m_pXmlNodePtr->doc,
- m_pXmlNodePtr->ns,
- (const xmlChar *)f_cNodeName.c_str(),
- l_cNodeContent))) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error creating child node");
- } else {
- l_pChildNode->type = XML_ELEMENT_NODE;
- l_pChildNode->parent = m_pXmlNodePtr;
- l_pChildNode->doc = m_pXmlNodePtr->doc;
-
- // if there is no other child to the parent
- if (m_pXmlNodePtr->children == NULL) {
- m_pXmlNodePtr->children = l_pChildNode;
- m_pXmlNodePtr->last = l_pChildNode;
- } else { // else add the new child to the end of children list
- // temp node
- xmlNodePtr l_pTempNode = m_pXmlNodePtr->last;
- l_pTempNode->next = l_pChildNode;
- l_pChildNode->prev = l_pTempNode;
-
- m_pXmlNodePtr->last = l_pChildNode;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return CXmlNode(l_pChildNode);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddSiblingNode
-/// Adds new node as sibling to the current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-CXmlNode CXmlNode::AddSiblingNode(std::string f_cNodeName, std::string f_cText) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- xmlNodePtr l_pNewNode = NULL;
- xmlNodePtr l_pSiblingNode = NULL;
-
- if (NULL != m_pXmlNodePtr &&
- !this->Parent().IsNull()) { // check whether the node is root node
- if (NULL != (l_pNewNode = xmlNewNode(NULL,
- (const xmlChar *)f_cNodeName.c_str()))) {
- if (0 < f_cText.length()) {
- xmlChar* p_text = reinterpret_cast<xmlChar*>(const_cast<char*>(f_cText.c_str()));
- xmlNodeSetContent(l_pNewNode, p_text);
- }
-
- l_pSiblingNode = xmlAddSibling(m_pXmlNodePtr,
- l_pNewNode);
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return CXmlNode(l_pSiblingNode);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveChildNode
-/// Removes the child node from current node
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::RemoveChildNode(std::string f_cNodeName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- CXmlNode l_pXmlNode = FindChildNode(f_cNodeName);
- if (!l_pXmlNode.IsNull()) {
- xmlUnlinkNode(l_pXmlNode.m_pXmlNodePtr);
- xmlFreeNode(l_pXmlNode.m_pXmlNodePtr);
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ClearNode
-/// Clears the contents, attributes of node
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CXmlNode::ClearNode() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
-
- if (NULL != m_pXmlNodePtr) {
- for (xmlNodePtr l_pXmlNode = m_pXmlNodePtr->children;
- l_pXmlNode != NULL;
- l_pXmlNode = m_pXmlNodePtr->children) {
- xmlUnlinkNode(l_pXmlNode);
- xmlFreeNode(l_pXmlNode);
- }
-
- for (xmlAttrPtr l_pXmlAttr = m_pXmlNodePtr->properties;
- l_pXmlAttr != NULL;
- l_pXmlAttr = m_pXmlNodePtr->properties) {
- xmlRemoveProp(l_pXmlAttr);
- }
- } else {
- l_eStatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_eStatus;
-}