I'm trying to parse an xml document using the following:
XmlDocument doc = new XmlDocument ();
The type or namespace name 'XmlDocument' could not be
found. Are you missing an assembly reference?
As I posted on the Xamarin forums: http://forums.xamarin.com/discussion/46042/missing-assembly-reference-for-system-xml#latest
XDocument.Parse(string) to accomplish this from your Portable Class Library.
XDocument is included in the
System.Xml.Linq namespace so you will need to add the using directive for that namespace in your class.
The reason that you cannot access
XmlDocument from a Portable Class Library (PCL) is due to the fact that a PCL will only expose APIs that are supported on all platforms that the PCL targets. Windows Phone 8 does not support XmlDocument, and so this isn't available in the PCL. Windows Store apps support XmlDocument but it is available in a different namespace (
Windows.Data.Xml.Dom). So for this reason
System.Xml.XmlDocument cannot be used from the PCL. Anything else provided through the
System.Xml namespace in the PCL is fine to use.