... | ... |
@@ -260,6 +260,21 @@ static int msxml_parse_element(struct msxml_ctx *mxctx, xmlTextReaderPtr reader, |
260 | 260 |
cli_msxmlmsg("msxml_parse_element: retrieved json object [Count]\n"); |
261 | 261 |
} |
262 | 262 |
|
263 |
+ /* check if multiple entries are allowed */ |
|
264 |
+ if (thisjobj && (keyinfo->type & MSXML_JSON_MULTI)) { |
|
265 |
+ /* replace this object with an array entry object */ |
|
266 |
+ json_object *multi = cli_jsonarray(thisjobj, "Multi"); |
|
267 |
+ if (!multi) { |
|
268 |
+ return CL_EMEM; |
|
269 |
+ } |
|
270 |
+ cli_msxmlmsg("msxml_parse_element: generated or retrieved json multi array\n"); |
|
271 |
+ |
|
272 |
+ thisjobj = cli_jsonobj(multi, NULL); |
|
273 |
+ if (!thisjobj) |
|
274 |
+ return CL_EMEM; |
|
275 |
+ cli_msxmlmsg("msxml_parse_element: generated json multi entry object\n"); |
|
276 |
+ } |
|
277 |
+ |
|
263 | 278 |
/* handle attributes */ |
264 | 279 |
if (thisjobj && (keyinfo->type & MSXML_JSON_ATTRIB)) { |
265 | 280 |
state = xmlTextReaderHasAttributes(reader); |
... | ... |
@@ -50,19 +50,20 @@ struct attrib_entry { |
50 | 50 |
|
51 | 51 |
struct key_entry { |
52 | 52 |
/* how */ |
53 |
-#define MSXML_IGNORE 0x00 |
|
54 |
-#define MSXML_IGNORE_ELEM 0x01 |
|
55 |
-#define MSXML_SCAN_CB 0x02 |
|
56 |
-#define MSXML_SCAN_B64 0x04 |
|
53 |
+#define MSXML_IGNORE 0x0 |
|
54 |
+#define MSXML_IGNORE_ELEM 0x1 |
|
55 |
+#define MSXML_SCAN_CB 0x2 |
|
56 |
+#define MSXML_SCAN_B64 0x4 |
|
57 | 57 |
/* where */ |
58 |
-#define MSXML_JSON_ROOT 0x08 |
|
59 |
-#define MSXML_JSON_WRKPTR 0x10 |
|
58 |
+#define MSXML_JSON_ROOT 0x8 |
|
59 |
+#define MSXML_JSON_WRKPTR 0x10 |
|
60 |
+#define MSXML_JSON_MULTI 0x20 |
|
60 | 61 |
|
61 | 62 |
#define MSXML_JSON_TRACK (MSXML_JSON_ROOT | MSXML_JSON_WRKPTR) |
62 | 63 |
/* what */ |
63 |
-#define MSXML_JSON_COUNT 0x20 |
|
64 |
-#define MSXML_JSON_VALUE 0x40 |
|
65 |
-#define MSXML_JSON_ATTRIB 0x80 |
|
64 |
+#define MSXML_JSON_COUNT 0x40 |
|
65 |
+#define MSXML_JSON_VALUE 0x80 |
|
66 |
+#define MSXML_JSON_ATTRIB 0x100 |
|
66 | 67 |
|
67 | 68 |
const char *key; |
68 | 69 |
const char *name; |