How to parse OPML with XDocument in Windows Phone

2019-06-05 22:20发布

问题:

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.