Is there a way with Linq to XML to isolate and retrieve the attributes of the encoding declaration?
<?xml version="1.0" encoding="UTF-8" ?>
It seems like you can initalize an XDoc or XElement with the whole document or just a starting element, but how would you Isolate this tag… it doesnt have a name… or at least I dont know if it does.
You can use the XDocument.Declaration Property:
As a bonus, you can get the version number too: