Tizen Native API

We are going to parse an XML sample file and print the data to stdout.

Like all examples we start by including Eina:

We declare 2 booleans to keep track of tags:

Here we declare some variables and initialize eina:

We fill buffer with the XML data from chat.xml:

We will use an Eina_Array to store the data:

Here we call eina_simple_xml_parse(). We pass the buffer with data, its size, we ask to strip leading and trailing whitespace, we give the callback function and the array to store the formatted data:

This will loop over the array and print the data using _print callback:

This is the main XML parser callback, it will check for known tags and get the corresponding values:

We first check for opening tag:

If we know the tag should have attributes, then we find them using eina_simple_xml_tag_attributes_find() and give them to another parsing function using eina_simple_xml_attributes_parse():

We check for other known tags:

We then check data for corresponding tag:

We are doing the formatting in same time and put all the <post> children in str.

Finally, we store our string in the array:

This is the callback to parse the attributes, we check for key name and keep the value:

This is the function that simply print items of the array:

You can see the full source code here.