axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
axlNode * axl_node_parse_strings ( axlError **  error,
  ... 
)

This function allows to create a xml node from the provided xml content (bootstraping XML content).

This function is useful if it is required to create a node with a particular complex content, without going into the detail of creating all childs, attributes and content.

Here is an example:

1 axlError * error = NULL;
2 axlNode * node = NULL;
3 
4 // parse document
5 root = axl_node_parse_strings (error,
6  "<child>",
7  " <widget class=\"GtkLabel\" id=\"label4\">",
8  " <property name=\"visible\">True</property>",
9  " <property name=\"label\" translatable=\"yes\">&lt;b&gt;1. Seleccione el sistema:&lt;/b&gt;</property>",
10  " <property name=\"use_underline\">False</property>",
11  " <property name=\"use_markup\">True</property>",
12  " <property name=\"justify\">GTK_JUSTIFY_LEFT</property>",
13  " <property name=\"wrap\">False</property>",
14  " <property name=\"selectable\">False</property>",
15  " <property name=\"xalign\">0</property>",
16  " <property name=\"yalign\">0.5</property>",
17  " <property name=\"xpad\">0</property>",
18  " <property name=\"ypad\">0</property>",
19  " <property name=\"ellipsize\">PANGO_ELLIPSIZE_NONE</property>",
20  " <property name=\"width_chars\">-1</property>",
21  " <property name=\"single_line_mode\">False</property>",
22  " <property name=\"angle\">0</property>",
23  " </widget>",
24  " <packing>",
25  " <property name=\"padding\">0</property>",
26  " <property name=\"expand\">False</property>",
27  " <property name=\"fill\">False</property>",
28  " </packing>",
29  "</child>",
30  NULL);
31 if (root == NULL) {
32  printf ("Error: unable to parse content, error: %s\n", axl_error_get (error));
33  axl_error_free (error);
34  return;
35 }
36 
37 // once finished, free the node
38 axl_node_free (root);
Parameters
errorOptional error reference to report parsing error problems that can be found.

The function receives a set of strings, separate by comma, ended by NULL.

Returns
A newly allocated reference to the axlNode or NULL if it fails. In such case, the error variable is filled with the error found.

References axl_doc_free(), axl_doc_get_root(), axl_doc_parse(), axl_free(), AXL_LEVEL_DEBUG, axl_node_annotate_data_full(), axl_node_deattach(), axl_return_val_if_fail, and axl_stream_concat().