I wasted too much time on this issue and thought to write on the forum. I really appriciate if you can help me for this issue.
There is an API which is giving xml output. But It is not gving all fields what I want. The owner of API is saying me that should work and it should give all records. I will show the demo XML file and my datatable C# code to explain my issue.
Column count is 5 and Other columns are not in the data table. I just noticed that is not retrieving records which has an additional attribute like
type="integer"
. There are only 5 records which dont have a type and that is what I can retrieve. So where is the issue?
Please can you help me to get all records from the xml file?
maduranga001
Member
162 Points
235 Posts
get data from XML datatable
Nov 10, 2011 01:58 AM|LINK
Hello,
I wasted too much time on this issue and thought to write on the forum. I really appriciate if you can help me for this issue.
There is an API which is giving xml output. But It is not gving all fields what I want. The owner of API is saying me that should work and it should give all records. I will show the demo XML file and my datatable C# code to explain my issue.
This is the XML file.
<?xml version="1.0" encoding="UTF-8"?> <tickets type="array" count="9"> <ticket> <assigned-at type="datetime">2011-09-27T16:49:38+10:00</assigned-at> <assignee-id type="integer">5966436</assignee-id> <base-score type="integer">180</base-score> <created-at type="datetime">2011-09-27T16:46:43+10:00</created-at> <current-collaborators nil="true"></current-collaborators> <current-tags>email errors services spade</current-tags> <description>Hi , Here is the Fact Find & Credit Proposal. Sorry it has taken me so long.Kind regards</description> <due-date type="datetime" nil="true"></due-date> <entry-id type="integer" nil="true"></entry-id> <external-id nil="true"></external-id> <field-288754 type=""></field-288754> <group-id type="integer">20061346</group-id> <initially-assigned-at type="datetime">2011-09-27T16:46:43+10:00</initially-assigned-at> <latest-recipients nil="true"></latest-recipients> <nice-id type="integer">6791</nice-id> <organization-id type="integer">20342216</organization-id> <organization-name type="">WWS Selector Group</organization-name> <original-recipient-address>support@mine.com</original-recipient-address> <priority-id type="integer">0</priority-id> <recipient>support@test.zendesk.com</recipient> <req-name type="">Kosi Woolsey</req-name> <requester-id type="integer">26236338</requester-id> <resolution-time type="integer" nil="true"></resolution-time> <solved-at type="datetime" nil="true"></solved-at> <status-id type="integer">1</status-id> <status-updated-at type="datetime">2011-09-27T16:46:43+10:00</status-updated-at> <subject>The Selector Group</subject> <submitter-id type="integer">26236338</submitter-id> <ticket-type-id type="integer">0</ticket-type-id> <updated-at type="datetime">2011-09-27T16:49:38+10:00</updated-at> <updated-by-type-id type="integer">0</updated-by-type-id> <via-id type="integer">4</via-id> <score type="integer">180</score> <problem-id nil="true"></problem-id> <channel nil="true"></channel> <permissions type="array"> </permissions> </ticket> </tickets>public static DataTable GetTickets() { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(_myDomain + "/rules/651263.xml"); request.Method = "GET"; request.Credentials = new NetworkCredential(_Username, _Password); request.ContentLength = 0; HttpWebResponse resp = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream()); string tmp = reader.ReadToEnd(); StringReader stream = new StringReader(tmp); DataSet ds = new DataSet(); ds.ReadXml(stream); DataTable dt = ds.Tables["ticket"]; return dt; }Ok. I tried to get data from that code.
This is working and returning values
But this is not working..
Column count is 5 and Other columns are not in the data table. I just noticed that is not retrieving records which has an additional attribute like type="integer" . There are only 5 records which dont have a type and that is what I can retrieve. So where is the issue?
Please can you help me to get all records from the xml file?
A big help !
Thanks!