Files
ANSLIB/ONVIF/include/bm/xml_node.h
2026-03-28 11:39:04 +11:00

90 lines
3.2 KiB
C

/***************************************************************************************
*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
*
* By downloading, copying, installing or using the software you agree to this license.
* If you do not agree to this license, do not download, install,
* copy or use the software.
*
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
*
* Redistribution and use in binary forms, with or without modification, are permitted.
*
* 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.
*
****************************************************************************************/
#ifndef XML_NODE_H
#define XML_NODE_H
/***************************************************************************************
*
* XML node define
*
***************************************************************************************/
#define NTYPE_TAG 0
#define NTYPE_ATTRIB 1
#define NTYPE_CDATA 2
#define NTYPE_LAST 2
#define NTYPE_UNDEF -1
typedef struct XMLN
{
int flag; // Is the buffer pointed to by data dynamically allocated memory? If so, it needs to be free
const char * name;
uint32 type;
const char * data;
int dlen;
int finish;
struct XMLN * parent;
struct XMLN * f_child;
struct XMLN * l_child;
struct XMLN * prev;
struct XMLN * next;
struct XMLN * f_attrib;
struct XMLN * l_attrib;
} XMLN;
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************************/
HT_API XMLN * xml_node_add(XMLN * parent, const char * name);
HT_API void xml_node_del(XMLN * p_node);
HT_API XMLN * xml_node_get(XMLN * parent, const char * name);
HT_API int soap_strcmp(const char * str1, const char * str2);
HT_API void soap_strncpy(char * dest, const char * src, int size);
HT_API XMLN * xml_node_soap_get(XMLN * parent, const char * name);
/***************************************************************************************/
HT_API XMLN * xml_attr_add(XMLN * p_node, const char * name, const char * value);
HT_API void xml_attr_del(XMLN * p_node, const char * name);
HT_API const char * xml_attr_get(XMLN * p_node, const char * name);
HT_API XMLN * xml_attr_node_get(XMLN * p_node, const char * name);
/***************************************************************************************/
HT_API void xml_cdata_set(XMLN * p_node, const char * value, int len);
/***************************************************************************************/
HT_API int xml_calc_buf_len(XMLN * p_node);
HT_API int xml_write_buf(XMLN * p_node, char * xml_buf, int buf_len);
/***************************************************************************************/
HT_API XMLN * xxx_hxml_parse(char * p_xml, int len);
#ifdef __cplusplus
}
#endif
#endif // XML_NODE_H