我收到以下错误:
' ',十六进制值 0x1F,是无效字符
这是我的功能。第一次点击“reader.MoveToContent()”时出现此错误。谁能指出我正确的方向?
Public Function GetSyndicationFeedData(ByVal urlFeedLocation As String) As SyndicationFeed
Dim settings As New XmlReaderSettings() With { _
.IgnoreWhitespace = True, _
.CheckCharacters = True, _
.CloseInput = True, _
.IgnoreComments = True, _
.IgnoreProcessingInstructions = True _
}
If [String].IsNullOrEmpty(urlFeedLocation) Then
Return Nothing
End If
Using reader As XmlReader = XmlReader.Create(urlFeedLocation, settings)
If reader.ReadState = ReadState.Initial Then
reader.MoveToContent()
End If
' Now try reading...
Dim atom As New Atom10FeedFormatter()
Dim rss20 As New Rss20FeedFormatter()
' Atom
If atom.CanRead(reader) Then
atom.ReadFrom(reader)
Return atom.Feed
'Rss 2.0
ElseIf rss20.CanRead(reader) Then
rss20.ReadFrom(reader)
Return rss20.Feed
Else
Return Nothing
End If
End Using
End Function