axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
axlNode * axl_node_get_first_child ( axlNode node)

Allows to get the first child that holds the node.

This function is considered inside the CHILDREN API, which is the set of functions that are used to handle XML documents that have node that contains more nodes or content, but not mixed.

This function allows to get the first child found that is an axlNode. In the case your application is handling a document that don't mix nodes and content at the same level inside another xml nodes, you'll get the expected results.

But, calling to this function on a node that contains content mixed with another nodes, you will skip all items stored before the first xml node found as child.

Let's see some examples to clarify this. Provided the following xml document:

1 <document>
2  <child>
3  Content
4  </child>
5 </document>

If you want to get a reference to the child node you can do the following:

1 // supposing the document is already loaded in "doc"
2 axlNode * node = axl_doc_get_root (doc);
3 
4 // get the first child
5 node = axl_node_get_first_child (node);
6 
7 // now you have in "node" a reference to the child node.

However, in the case the previous content mix node with content as follows:

1 <document>
2  Some content previous to the first child.
3  <child>
4  Content
5  </child>
6 </document>

Using this function will make you to skip the first content, that is, "Some content previous to the first child", which is found before the <child> node. In the case you want to have full access to all items stored as child for a particular node, check axl_item_get_first_child.

Parameters
nodeThe node that is requested to return its first child.
Returns
The first child node or NULL if it has no child node. Do not release (axl_node_free) result returned by this function. It is a reference to the internal document.

References axl_item_get_type(), axl_return_val_if_fail, and ITEM_NODE.

Referenced by axl_node_find_called(), axl_ns_node_find_called(), and axl_ns_node_get_child_called().