Lines Matching refs:ctx
15 static xml_node_t * get_node_uri_iter(struct xml_node_ctx *ctx, in get_node_uri_iter() argument
27 xml_node_for_each_sibling(ctx, node) { in get_node_uri_iter()
28 xml_node_for_each_check(ctx, node); in get_node_uri_iter()
29 name = xml_node_get_localname(ctx, node); in get_node_uri_iter()
38 return get_node_uri_iter(ctx, xml_node_first_child(ctx, node), in get_node_uri_iter()
46 xml_node_t * get_node_uri(struct xml_node_ctx *ctx, xml_node_t *root, in get_node_uri() argument
56 node = get_node_uri_iter(ctx, root, search); in get_node_uri()
63 static xml_node_t * get_node_iter(struct xml_node_ctx *ctx, in get_node_iter() argument
74 xml_node_for_each_child(ctx, node, root) { in get_node_iter()
75 xml_node_for_each_check(ctx, node); in get_node_iter()
76 name = xml_node_get_localname(ctx, node); in get_node_iter()
84 return get_node_iter(ctx, node, end); in get_node_iter()
89 xml_node_t * get_node(struct xml_node_ctx *ctx, xml_node_t *root, in get_node() argument
99 node = get_node_iter(ctx, root, search); in get_node()
106 xml_node_t * get_child_node(struct xml_node_ctx *ctx, xml_node_t *root, in get_child_node() argument
112 xml_node_for_each_child(ctx, node, root) { in get_child_node()
113 xml_node_for_each_check(ctx, node); in get_child_node()
114 match = get_node(ctx, node, path); in get_child_node()
123 xml_node_t * node_from_file(struct xml_node_ctx *ctx, const char *name) in node_from_file() argument
162 node = xml_node_from_buf(ctx, buf); in node_from_file()
169 int node_to_file(struct xml_node_ctx *ctx, const char *fname, xml_node_t *node) in node_to_file() argument
174 str = xml_node_to_str(ctx, node); in node_to_file()
192 static char * get_val(struct xml_node_ctx *ctx, xml_node_t *node) in get_val() argument
196 val = xml_node_get_text(ctx, node); in get_val()
227 static void node_to_tnds(struct xml_node_ctx *ctx, xml_node_t *out, in node_to_tnds() argument
236 xml_node_for_each_child(ctx, node, in) { in node_to_tnds()
237 xml_node_for_each_check(ctx, node); in node_to_tnds()
238 name = xml_node_get_localname(ctx, node); in node_to_tnds()
240 tnds = xml_node_create(ctx, out, NULL, "Node"); in node_to_tnds()
243 xml_node_create_text(ctx, tnds, NULL, "NodeName", name); in node_to_tnds()
246 xml_node_create_text(ctx, tnds, NULL, "Path", uri); in node_to_tnds()
248 val = get_val(ctx, node); in node_to_tnds()
249 if (val || !xml_node_first_child(ctx, node)) in node_to_tnds()
250 xml_node_create_text(ctx, tnds, NULL, "Value", in node_to_tnds()
252 xml_node_get_text_free(ctx, val); in node_to_tnds()
255 node_to_tnds(ctx, new_uri ? out : tnds, node, new_uri); in node_to_tnds()
261 static int add_ddfname(struct xml_node_ctx *ctx, xml_node_t *parent, in add_ddfname() argument
266 node = xml_node_create(ctx, parent, NULL, "RTProperties"); in add_ddfname()
269 node = xml_node_create(ctx, node, NULL, "Type"); in add_ddfname()
272 xml_node_create_text(ctx, node, NULL, "DDFName", urn); in add_ddfname()
277 xml_node_t * mo_to_tnds(struct xml_node_ctx *ctx, xml_node_t *mo, in mo_to_tnds() argument
284 root = xml_node_create_root(ctx, ns_uri, NULL, NULL, "MgmtTree"); in mo_to_tnds()
288 xml_node_create_text(ctx, root, NULL, "VerDTD", "1.2"); in mo_to_tnds()
290 name = xml_node_get_localname(ctx, mo); in mo_to_tnds()
292 node = xml_node_create(ctx, root, NULL, "Node"); in mo_to_tnds()
295 xml_node_create_text(ctx, node, NULL, "NodeName", name); in mo_to_tnds()
297 add_ddfname(ctx, node, urn); in mo_to_tnds()
299 node_to_tnds(ctx, use_path ? root : node, mo, use_path ? name : NULL); in mo_to_tnds()
304 xml_node_free(ctx, root); in mo_to_tnds()
309 static xml_node_t * get_first_child_node(struct xml_node_ctx *ctx, in get_first_child_node() argument
316 xml_node_for_each_child(ctx, child, node) { in get_first_child_node()
317 xml_node_for_each_check(ctx, child); in get_first_child_node()
318 lname = xml_node_get_localname(ctx, child); in get_first_child_node()
327 static char * get_node_text(struct xml_node_ctx *ctx, xml_node_t *node, in get_node_text() argument
330 node = get_first_child_node(ctx, node, node_name); in get_node_text()
333 return xml_node_get_text(ctx, node); in get_node_text()
337 static xml_node_t * add_mo_node(struct xml_node_ctx *ctx, xml_node_t *root, in add_mo_node() argument
343 nodename = get_node_text(ctx, node, "NodeName"); in add_mo_node()
346 value = get_node_text(ctx, node, "Value"); in add_mo_node()
349 root = xml_node_create_root(ctx, NULL, NULL, NULL, in add_mo_node()
352 xml_node_set_text(ctx, root, value); in add_mo_node()
355 xml_node_get_text_free(ctx, nodename); in add_mo_node()
356 xml_node_get_text_free(ctx, value); in add_mo_node()
359 path = get_node_text(ctx, node, "Path"); in add_mo_node()
362 parent = get_node_uri(ctx, root, uri); in add_mo_node()
363 xml_node_get_text_free(ctx, path); in add_mo_node()
366 xml_node_get_text_free(ctx, nodename); in add_mo_node()
367 xml_node_get_text_free(ctx, value); in add_mo_node()
371 xml_node_create_text(ctx, parent, NULL, nodename, in add_mo_node()
374 xml_node_create(ctx, parent, NULL, nodename); in add_mo_node()
377 xml_node_get_text_free(ctx, nodename); in add_mo_node()
378 xml_node_get_text_free(ctx, value); in add_mo_node()
384 static xml_node_t * tnds_to_mo_iter(struct xml_node_ctx *ctx, xml_node_t *root, in tnds_to_mo_iter() argument
391 xml_node_for_each_sibling(ctx, node) { in tnds_to_mo_iter()
392 xml_node_for_each_check(ctx, node); in tnds_to_mo_iter()
394 nodename = get_node_text(ctx, node, "NodeName"); in tnds_to_mo_iter()
398 name = xml_node_get_localname(ctx, node); in tnds_to_mo_iter()
403 xml_node_get_text_free(ctx, nodename); in tnds_to_mo_iter()
406 root = add_mo_node(ctx, root, node, uri); in tnds_to_mo_iter()
409 child = get_first_child_node(ctx, node, "Node"); in tnds_to_mo_iter()
412 tnds_to_mo_iter(ctx, root, child, nodename); in tnds_to_mo_iter()
416 tnds_to_mo_iter(ctx, root, child, new_uri); in tnds_to_mo_iter()
420 xml_node_get_text_free(ctx, nodename); in tnds_to_mo_iter()
427 xml_node_t * tnds_to_mo(struct xml_node_ctx *ctx, xml_node_t *tnds) in tnds_to_mo() argument
432 name = xml_node_get_localname(ctx, tnds); in tnds_to_mo()
436 node = get_first_child_node(ctx, tnds, "Node"); in tnds_to_mo()
439 return tnds_to_mo_iter(ctx, NULL, node, NULL); in tnds_to_mo()
443 xml_node_t * soap_build_envelope(struct xml_node_ctx *ctx, xml_node_t *node) in soap_build_envelope() argument
449 ctx, "http://www.w3.org/2003/05/soap-envelope", "soap12", &ns, in soap_build_envelope()
453 body = xml_node_create(ctx, envelope, ns, "Body"); in soap_build_envelope()
454 xml_node_add_child(ctx, body, node); in soap_build_envelope()
459 xml_node_t * soap_get_body(struct xml_node_ctx *ctx, xml_node_t *soap) in soap_get_body() argument
463 body = get_node_uri(ctx, soap, "Envelope/Body"); in soap_get_body()
466 xml_node_for_each_child(ctx, child, body) { in soap_get_body()
467 xml_node_for_each_check(ctx, child); in soap_get_body()