1

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.

juhariis
  • 568
  • 8
  • 15
  • 1
    `&` is a special character in XML, and will break an XML parser. Not sure if there's an easy way around this short of modifying the XML file before you get it, and replace `&` with `&`. I'm not a fan of manipulating XML prior to parsing, but have on occasion had no choice due to bad XML being received from third-party applications. – Tim Feb 12 '15 at 22:44
  • 1
    @juhariis It will help you : http://stackoverflow.com/questions/121511/reading-xml-with-an-into-c-sharp-xmldocument-object – Thirisangu Ramanathan Feb 19 '15 at 10:52

0 Answers0