开发者

getting attributes of href using libxml

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->nam开发者_如何学Goe,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


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

  • xmlSAX2StartElement
  • xmlSAX2StartElementNs.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜