| 1 |
#ifndef AWS_COMMON_XML_PARSER_H |
| 2 |
#define AWS_COMMON_XML_PARSER_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <aws/common/array_list.h> |
| 11 |
#include <aws/common/byte_buf.h> |
| 12 |
|
| 13 |
#include <aws/common/exports.h> |
| 14 |
|
| 15 |
AWS_PUSH_SANE_WARNING_LEVEL |
| 16 |
|
| 17 |
struct aws_xml_node; |
| 18 |
|
| 19 |
struct aws_xml_attribute { |
| 20 |
struct aws_byte_cursor name; |
| 21 |
struct aws_byte_cursor value; |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
typedef int(aws_xml_parser_on_node_encountered_fn)(struct aws_xml_node *node, void *user_data); |
| 36 |
|
| 37 |
struct aws_xml_parser_options { |
| 38 |
|
| 39 |
struct aws_byte_cursor doc; |
| 40 |
|
| 41 |
|
| 42 |
size_t max_depth; |
| 43 |
|
| 44 |
|
| 45 |
aws_xml_parser_on_node_encountered_fn *on_root_encountered; |
| 46 |
|
| 47 |
|
| 48 |
void *user_data; |
| 49 |
}; |
| 50 |
|
| 51 |
AWS_EXTERN_C_BEGIN |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
AWS_COMMON_API |
| 58 |
int aws_xml_parse(struct aws_allocator *allocator, const struct aws_xml_parser_options *options); |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
AWS_COMMON_API |
| 65 |
int aws_xml_node_as_body(struct aws_xml_node *node, struct aws_byte_cursor *out_body); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
AWS_COMMON_API |
| 72 |
int aws_xml_node_as_body_unescaped( |
| 73 |
struct aws_allocator *allocator, |
| 74 |
struct aws_xml_node *node, |
| 75 |
struct aws_byte_buf *out_body); |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
AWS_COMMON_API |
| 81 |
int aws_xml_node_traverse( |
| 82 |
struct aws_xml_node *node, |
| 83 |
aws_xml_parser_on_node_encountered_fn *on_node_encountered, |
| 84 |
void *user_data); |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
AWS_COMMON_API |
| 90 |
struct aws_byte_cursor aws_xml_node_get_name(const struct aws_xml_node *node); |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
AWS_COMMON_API |
| 96 |
size_t aws_xml_node_get_num_attributes(const struct aws_xml_node *node); |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
AWS_COMMON_API |
| 102 |
struct aws_xml_attribute aws_xml_node_get_attribute(const struct aws_xml_node *node, size_t attribute_index); |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
AWS_COMMON_API |
| 109 |
int aws_byte_buf_append_unescaped_xml( |
| 110 |
struct aws_allocator *allocator, |
| 111 |
struct aws_byte_cursor data, |
| 112 |
struct aws_byte_buf *out); |
| 113 |
|
| 114 |
AWS_EXTERN_C_END |
| 115 |
AWS_POP_SANE_WARNING_LEVEL |
| 116 |
|
| 117 |
#endif |