从GData Youtube解析XML错误

时间:2013-04-12 22:43:57

标签: xml api parsing gdata

从gdata api解析数据时,我遇到了一个非常烦人的错误,我真的不明白为什么会在这里收到错误。 xml直接来自gdata api。

 Dim Document As XDocument = XDocument.Parse(Response.Html)

错误是:'='是一个意外的令牌。预期的标记是';'。第1行,第1142位。

这是输入的XML

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007" gd:etag="W/&quot;DEMHQXg5cSp7I2A9WhBWGE0.&quot;">
    <id>tag:youtube.com,2008:video:OtyPaMYuC0Q:comments</id>
    <updated>2013-04-12T22:40:30.629Z</updated>
    <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#comment" />
    <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
    <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments" />
    <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments" />
    <link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments/batch" />
    <link rel="self" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments?start-index=1&amp;max-results=1" />
    <link rel="service" type="application/atomsvc+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments?alt=atom-service" />
    <link rel="next" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments?start-index=2&amp;max-results=1" />
    <author>
        <name>YouTube</name>
        <uri>http://www.youtube.com/</uri>
    </author>
    <generator version="2.1" uri="http://gdata.youtube.com">YouTube data API</generator>
    <openSearch:totalResults>9284</openSearch:totalResults>
    <openSearch:startIndex>1</openSearch:startIndex>
    <openSearch:itemsPerPage>1</openSearch:itemsPerPage>
    <entry gd:etag="W/&quot;DkQNRn47eCp7I2A9WhBWGE0.&quot;">
        <id>tag:youtube.com,2008:video:OtyPaMYuC0Q:comment:pGfDzo6Y7ksUb5ICc3XxO4jP7npln-jyFXhsyFfp3H8</id>
        <published>2013-04-12T22:06:37.000Z</published>
        <updated>2013-04-12T22:06:37.000Z</updated>
        <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#comment" />
        <title>No Scrubs, What You ...</title>
        <content>No Scrubs, What You Know, Say My Name, Sweet Dreams... etc.  I wrote some crap for Michael &amp; Janet Jackson, Rihanna, Chris Brown, etc.  I've worked with a lot of people who were once famous, or who may still be famous.  I'm very proud if someone started off with me and went on to achieve great things.  Because it's always good because then I can count on them, possibly in the future.  I wrote most of the first Lady Gaga album, beats and lyrics.  I was very proud of those songs.</content>
        <link rel="related" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q" />
        <link rel="alternate" type="text/html" href="https://www.youtube.com/watch?v=OtyPaMYuC0Q" />
        <link rel="self" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/OtyPaMYuC0Q/comments/pGfDzo6Y7ksUb5ICc3XxO4jP7npln-jyFXhsyFfp3H8" />
        <author>
            <name>nameless777</name>
            <uri>https://gdata.youtube.com/feeds/api/users/nameless777</uri>
            <yt:userId>vBwfm3xuTJYlHobnMa0Oaw</yt:userId>
        </author>
        <yt:videoid>OtyPaMYuC0Q</yt:videoid>
    </entry>
</feed>

1 个答案:

答案 0 :(得分:0)

没关系,出于某种原因我不得不使用流加载。