2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 //////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup MY 14 Platfom Software Team
19 /// \brief Internal Header for ns_config_parser_XML.c
21 /// These functions are used to read from and write to XML file.
24 //////////////////////////////////////////////////////////////////////////////////////////////////
26 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
27 #define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_
34 #include <ns_config_parser_internal.h>
35 #define BUFFERSIZE 200
38 ////////////////////////////////////////////////////////////////////////////////////////////
40 /// Function : get value for given key.
42 /// \param [in] pCurrNode
43 /// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
44 /// \param [in] pNodePath
45 /// const char * - pNodePath is a Pointer to path of Current XML node.
46 /// \param [in] pUserKey
47 /// const char * - pUserKey is a Pointer to Key provided by user.
48 /// \param [in] pReturnValue
49 /// char * - pReturnValue is a Pointer to value to be returned corresponding to Key.
50 /// \param [in] pReturnState
51 /// int * - pReturnState is updated depending upon user provided Key\n
52 /// returns 0 if user passed valid key.\n
53 /// returns 1 if user passed invalid key.\n
56 ///////////////////////////////////////////////////////////////////////////////////////////
57 void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue,
60 ////////////////////////////////////////////////////////////////////////////////////////////
61 /// XMLUpdateOldValue:
62 /// Function : update value corresponding to given user key.
64 /// \param [in] pCurrNode
65 /// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
66 /// \param [in] pNodePath
67 /// const char * - pNodePath is a Pointer to path of Current XML node.
68 /// \param [in] pUserKey
69 /// const char * - pUserKey is a Pointer to Key provided by user.
70 /// \param [in] pValue
71 /// const char * - pValue is a Pointer to the new value for attribute or text.
72 /// \param [in] pReturnState
73 /// int * - returns 0 if user passed valid key.\n
74 /// returns -6 if old value is not updated with new value.\n
77 ///////////////////////////////////////////////////////////////////////////////////////////
78 void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue,
81 ////////////////////////////////////////////////////////////////////////////////////////////
82 /// XMLUpdateOldValueWithNewValue:
83 /// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n
84 /// if old value matched then write new value in place of old value.
86 /// \param [in] pCurrNode
87 /// xmlNodePtr - pCurrNode is a Pointer to node of XML tree.
88 /// \param [in] pNodePath
89 /// const char * -pNodePath is a Pointer to path of Current XML node.
90 /// \param [in] pUserKey
91 /// const char * -pUserKey is a Pointer to Key provided by user.
92 /// \param [in] pOldValue
93 /// const char * - pOldValue is a Pointer to the old value for attribute or text of key passed.
94 /// \param [in] pNewValue
95 /// const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key.
96 /// \param [in] pReturnState
97 /// int * - returns 0 if user passed valid key.\n
98 /// returns -6 if old value is not updated with new value.\n
101 ///////////////////////////////////////////////////////////////////////////////////////////
102 void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey,
103 const char *poldvalue, const char *pnewvalue, int *preturnstate);
111 #endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_