开发者

parsing xml attribute value

I have been parsing xml content using the xmlreader and cannot use the xml document but so far it works getting all elementcontent except for the attribute contents. I need to parse the link below found in the following entry;

<title>XXXX UUUUUU posted a</title>
<category term="NotePosted" label="Note Posted"/>
 <link rel="alternate" type="html"  href="http://www.dfsddsfdsf.com/profile.php?id=sdfdfsfdsdfddfsfd&amp;v=wall&amp;story_dbid=dssdfasdfdasfdsafafafa"/>
<source>......... <source>

I need the href tag in the link attribute but it keeps coming back null.

                 While ureader.Read
                    If ureader.HasAttributes Then
                        fId = ureader.GetAttribute("href")
                        If fId.Contains("?v=wall&amp") Then
                            fIdList.Add(fId)
                            Exit While
     开发者_高级运维                   End If
                        If String.IsNullOrEmpty(fId) Then
                            fId = "NOTHING"
                        End If
                    End If
                End While


ureader.GetAttribute("link")

should be

ureader.GetAttribute("href")


figured it out finally

just added this

 If ureader.MoveToAttribute("href") Then
                        fId = ureader.ReadInnerXml
 End If
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜