axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
axlList * axl_doc_get_list ( axlDoc doc,
const char *  path_to 

Allows to get a particular node (or list of nodes) that are located at a selected path.

Providing a path, the function lookups for nodes stored on the selected location inside the provided document. The path provided doesn't follow the XPath extension.

Taking as a reference for the xml to be explained on the following rules:

1 <complex>
2  <data>
3  <node>
4  <row>10</row>
5  </node>
6  </data>
7 </complex>

Here is how the path works:

  • If provided a "/", the root node is returned. This is same than provided the root node name, like "/complex", when it is expected to find as root node <complex>. However, providing a particular node to search allows to get ensure that the root node is the one looked up.
  • To select nodes inside the first root node, in a generic way, without providing details about the root node name, you could use "//\*". This will provide all nodes that are found inside the root node, whatever it is called. If it is required to get all nodes, inside the root node, ensuring that the root one is called "complex" you should use: "/complex/\*"
  • If it is required to get a selected node inside the root node, that is called in a particular way you can use: //data. Again, if it is required to ensure that a particular node exists, from the top level down the leaf node, it will required to write something like: "/complex/data".
  • Remember that is totally different to query for "/complex/data" than "/complex/data/\*". The first one, returns the node, or nodes, called data that are inside the root node called complex, while the second one says: return all nodes inside the node data that is inside the root node called complex

Finally, keep in mind that this function only returns nodes. To get node content, attributes or anything else, you'll have to get the node first and then operate with it.

docThe axlDoc reference where the lookup will be performed.
path_toA path to the node (nodes) that are inside the path especifyied.
A list of nodes (axlNode) if the case something is found or NULL if fails to find something at the given path. If the path is right but no node match with it or there is no node, the function will return NULL reference rather a list with no nodes. Returned value must be deallocated by using axl_list_free.

References axl_cmp(), AXL_LEVEL_DEBUG, axl_list_add(), axl_list_free(), axl_list_new(), axl_node_get_child_called(), axl_node_get_name(), axl_return_val_if_fail, axl_stream_freev(), axl_stream_split(), axl_stream_strv_num(), and NODE_CMP_NAME.

Referenced by axl_doc_get().