How to parse OPML with XDocument in Windows Phone

十年热恋 提交于 2019-12-08 03:59:59

问题


I am parsing OPML with XDocument `(C#, Windows Phone) with

var _doc = XDocument.Parse(opmlFileString);

This works fine most of the time, e.g. stuff from http://www.digitalpodcast.com/podcastnews/opml-links/ or from http://www.bbc.co.uk/podcasts.opml has no problems.

The problem comes when trying to read a file with following constructs

<opml version="1.1" encoding="utf-8">
<head>
<title>My podcast list</title>
<dateCreated>06 February 2015</dateCreated>
</head>
<body>
<outline text="favourites">
<outline text="Yle Nyheter" type="rss" xmlUrl="http://areena.yle.fi/api/search.rss?id=1830156&media=audio&sisalto=ohjelmat" htmlUrl="http://areena.yle.fi/api/search.rss?id=1830156&sisalto=ohjelmat&media=audio" />
<outline text="Yle Uutiset" type="rss" xmlUrl="http://areena.yle.fi/api/search.rss?id=1492393&media=audio&sisalto=ohjelmat" htmlUrl="http://areena.yle.fi/api/search.rss?id=1492393&sisalto=ohjelmat&media=audio" />
<outline text="Yle Uutiset" type="rss" xmlUrl="http://areena.yle.fi/api/search.rss?id=1440981&media=audio&sisalto=ohjelmat" htmlUrl="http://areena.yle.fi/api/search.rss?id=1440981&sisalto=ohjelmat&media=audio" />
</outline>
</body>
</opml>

It looks like the parser gets confused with the construct

xmlUrl="http://areena.yle.fi/api/search.rss?id=1440981&media=audio&sisalto=ohjelmat"

It says that at the location where there is the second "=" should be ";" instead. (media=audio)

Is there a way to get around this? The links are working and provided by respective sites.

来源:https://stackoverflow.com/questions/28397741/how-to-parse-opml-with-xdocument-in-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!