I am new to the umbraco world. I am uploading an xml file using umbraco. I have a method that parses xml document on the backend using
System.Xml.Linq.
I am trying to get that file into an XDocument.
On the front end I have the following call that returns data
IPublishedContent doc = Umbraco.Media(CurrentPage.XMLfile);
but I dont know how to get that into a format that I can parse.
You can use TypedMedia method to have strongly typed object and use it's properties to retrieve / load file (e.g. from URL where it's stored inside the filesystem on your server).
Check: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/media-picker and then use your preferred way to load up XML document from specific location.
It will look like e.g (untested, but should point you in the right direction):
var typedDocument = Umbraco.Media(CurrentPage.XMLfile);
if(typedDocument != null) {
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath(typedDocument.Url));
// ... do whatever you want with your doc
}