[Ilugc] LibXML Reading Attributes
- From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
- Date: Fri May 12 12:14:18 2006
On 5/10/06, Bharathi Subramanian <sbharathi@xxxxxxxxxxxxx> wrote:
Anybody written a C program to read the XML Tag attributes value
using LibXML2? Kindly share with me. I am unable get an idea from
the LibXML2 API docs (http://xmlsoft.org/) for doing this.
<myTag myAttribute="1">
I got a idea to handle the attributes from a GTK tutorial. Here is
the code segment (using libxml2):
<snip>
if (cur->type == XML_ELEMENT_NODE &&
!xmlStrcmp (cur->name, (const xmlChar *) "myTag"))
{
printf ("TAG: %s \n", cur->name);
key = xmlGetProp (cur, "myAttribute");
if (key)
printf ("--> myAttribute=%s\n", key);
xmlFree(key);
}
</snip>
Thanks,
--
Bharathi S
Other related posts: