tags:

views:

65

answers:

1

Hi,

I have xml file nameed Hello as under with starting node as under:

/Hello xmlns:xsi: = "some text" xmlns:xsd = "some text" version="1.0"/

I tried to get the first and second attributes of node named Hello, using

xmlAttr *attr = nodePtr->properties;//nurrent node is Hello

while ( attr )
{

    NSLog(@"\n Attribute name:%s value:%s",attr->name,attr->children->content);

    attr = attr->next;
};

But, i could not get the first and second attributes, instead it only returns third attribute. How can i get the first and second attributes

A: 

I haven't used libxml in a very long time, but you may need a different approach for accessing attributes which introduce new namespace prefixes. Atleast in XPATH etc they belong in a different "axis".

See for example the following two functions in the SAX based API

Christopher Fairbairn
Thanks for your suggestion. I will check this out.
iSight
@Christopher Can you give some good links on tutorial to SAX interface for libxml.
iSight