summaryrefslogtreecommitdiffstats
path: root/stack/include/xml_bld_api.h
blob: 2d788e0dfa56c21cfecd15713b4a2f2129128c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*****************************************************************************
**
**  Name:       xml_bld_api.h
**
**  File:       XML Builder API
**
**
**  Copyright (c) 2000-2004, WIDCOMM Inc., All Rights Reserved.
**  WIDCOMM Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef XML_BLD_API_H
#define XML_BLD_API_H

#include "data_types.h"


/*****************************************************************************
**   Type Definitions
*****************************************************************************/

enum
{
    XML_BLD_SUCCESS,
    XML_BLD_ERROR
};
typedef UINT16 tXML_BLD_RESULT;


enum
{
    XML_ATTR_CONT = FALSE, /* not the end of attribute list. add quote(') */
    XML_ATTR_LAST = TRUE,  /* the last one of the attribute list. add quote('), greater_than(>), and line_feed(\n) */
    XML_ATTR_ETAG  = 2     /* the end of the element. add quote('), end_mark(/), greater_than(>), and line_feed(\n) */
};
typedef UINT8 tXML_ATTR_END;


/*****************************************************************************
**  External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif



/*****************************************************************************
**
**  Function:    XML_BufAddTag
**
**  Purpose:     Write a start or end tag and optional prefix.
**               
**  Parameters:  
**       UINT8       **pp_buf     reference to the storage to hold the XML object
**                                GOEP_WriteStore.
**       const UINT8*  prefix     tag prefix (namespace)
**       const UINT8*  tag        tag name
**       BOOLEAN       start_tag  TRUE = start tag, FALSE = end tag
**       BOOLEAN       has_attr   TRUE if the tag contains attributes
**       
**  Returns:     XML_BLD_SUCCESS if success
**
*****************************************************************************/
tXML_BLD_RESULT XML_BufAddTag (UINT8    **pp_buf, 
                            const UINT8 *prefix,
                            const UINT8 *tag, 
                            BOOLEAN     start_tag,
                            BOOLEAN     has_attr);


/*****************************************************************************
**
**  Function:    XML_BufAddAttribute
**
**  Purpose:     Write an attribute and optional prefix.
**               
**  Parameters:  
**       UINT8       **pp_buf     reference to the storage to hold the XML object
**       const UINT8*  prefix     attribute prefix (namespace)
**       const UINT8*  attr_name  attribute name
**       const UINT8*  attr_value attribute value
**       
**  Returns:     XML_BLD_SUCCESS if success
**
*****************************************************************************/
tXML_BLD_RESULT XML_BufAddAttribute (UINT8    **pp_buf, 
                                  const UINT8 *prefix,
                                  const UINT8 *attr_name, 
                                  const UINT8 *attr_value, 
                                  tXML_ATTR_END     last_attr);

/*****************************************************************************
**
**  Function:    XML_BufAddCharData
**
**  Purpose:     Write the element content.
**               
**  Parameters:  
**       UINT8       **pp_buf     reference to the storage to hold the XML object
**       const UINT8*  content    element content
**       
**  Returns:     XML_BLD_SUCCESS if success
**
*****************************************************************************/
tXML_BLD_RESULT XML_BufAddCharData (UINT8 **pp_buf, const UINT8 *charData);

#ifdef __cplusplus
}
#endif

#endif /* ifndef XML_BLD_API_H */