Hi,
I'm trying to read in some XML from an online source but not having much luck. What I don't know how to do is structure the .Element, I've tried different combinations using "Report_Data" and "Report_Entry". Report_Data encompases the entire XML object but is at the same level as "Report_Entry".
Here is my code
var url = "https://wd3-services1.junk.com/ccx/service/Generic_Data_Feed?Start_Date_from=2015-12-01-08:00&Start_Date_to=2016-01-01-08:00&format=simplexml"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Credentials = new NetworkCredential("username", "password"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); XDocument doc = XDocument.Load(receiveStream); XElement ge = doc .Element("Report_Data") .Element("Report_Entry"); reports.FirstName = ge.Element("firstName").Value; reports.LastName = ge.Element("lastName").Value;
and here is the XML
<wd:Report_Data xmlns:wd="urn:com.workday.report/HIG_Generic_Data_Feed"><wd:Report_Entry><wd:Employee_ID>00754</wd:Employee_ID><wd:Legal_Name_-_Title>Mr</wd:Legal_Name_-_Title><wd:Legal_Name>Fred Bloggs</wd:Legal_Name><wd:Preferred_Name_-_First_Name>Fred Bloggs</wd:Preferred_Name_-_First_Name><wd:firstName>Fred</wd:firstName><wd:lastName>Bloggs</wd:lastName><wd:Gender>Male</wd:Gender><wd:Job_Title>Teacher</wd:Job_Title><wd:Active_Status>0</wd:Active_Status><wd:Hire_Date>2012-06-25</wd:Hire_Date><wd:termination_date>2015-05-22</wd:termination_date><wd:continuous_service_date>2012-06-25</wd:continuous_service_date><wd:All_Managers_in_Management_Chain>Grande Fromage</wd:All_Managers_in_Management_Chain><wd:Worker_s_Manager><wd:Legal_Name>Blandine Arzur-Kean</wd:Legal_Name><wd:Manager_Supervisory_Org>DUAL Risk & Compliance (Stuart Priestley-Smith)</wd:Manager_Supervisory_Org><wd:Manager_Organisation_ID>SUP5.33</wd:Manager_Organisation_ID><wd:Company>Hyperion Insurance Group Limited</wd:Company></wd:Worker_s_Manager><wd:Superior_Org_ID>SUP5.33</wd:Superior_Org_ID></wd:Supervisory_Organization_-_Superior></wd:Report_Entry>
Any ideas?
Thanks