views:

18

answers:

1

I get a NotSupportedException when I parse the following string with an XElement:

<ref>S. L. Vartanyan*, V. E. Garutt† & A. V. Sher‡parallel, "Holocene dwarf mammoths from Wrangel Island in the Siberian Arctic", Nature 362, 337&nbsp;– 340 (25 March 1993) [http://www.nature.com/nature/journal/v362/n6418/abs/362337a0.html Nature.com]</ref>

Does anyone know why I get this error?

+1  A: 

Possibly the &nbsp; - that isn't an xml entity unless you are in html, and also the & should be &amp;?

Basically, that isn't xml...

This works:

@"<ref>S. L. Vartanyan*, V. E. Garutt† &amp; A. V. Sher‡parallel, ""Holocene dwarf mammoths from Wrangel Island in the Siberian Arctic"", Nature 362, 337not-nbsp;– 340 (25 March 1993) [http://www.nature.com/nature/journal/v362/n6418/abs/362337a0.html Nature.com]</ref>");
Marc Gravell
Razvi
@Razvi - it would be better to start with xml ;p
Marc Gravell
@Marc Gravell It's a reference from a raw wikipedia page ... thought i could use XElement to get the ref's name attribute's value and content. I wrote the parsing of the ref without XElement in the end :).
Razvi
@Razvi in *that* case, maybe the "HTML Agility Pack" would have solved this for you? It is much more forgiving than the strict xml parsers.
Marc Gravell