我一直在使用xmlreader解析xml内容,并且不能使用xml文档,但到目前为止,除了属性内容之外,它还可以获取所有elementcontent。我需要解析以下条目中的以下链接;
<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&v=wall&story_dbid=dssdfasdfdasfdsafafafa"/>
<source>......... <source>
我需要链接属性中的href标记,但它会一直返回null。
While ureader.Read
If ureader.HasAttributes Then
fId = ureader.GetAttribute("href")
If fId.Contains("?v=wall&") Then
fIdList.Add(fId)
Exit While
End If
If String.IsNullOrEmpty(fId) Then
fId = "NOTHING"
End If
End If
End While
答案 0 :(得分:1)
ureader.GetAttribute("link")
应该是
ureader.GetAttribute("href")
答案 1 :(得分:0)
终于弄明白了
刚刚添加了这个
If ureader.MoveToAttribute("href") Then
fId = ureader.ReadInnerXml
End If