Guest User

Untitled

a guest
Sep 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. <location>
  2. <name>Name</name>
  3. <weeks>
  4. <week>
  5. <Sunday>
  6. <times>
  7. <currently_open>false</currently_open>
  8. <status>open</status>
  9. <hours>
  10. <hour>
  11. <from>10am</from>
  12. <to>6pm</to>
  13. </hour>
  14. </hours>
  15. </times>
  16. <date>2018-09-23</date>
  17. <rendered>10am - 6pm</rendered>
  18. </Sunday>
  19. <Monday>
  20. <times>
  21. <currently_open>false</currently_open>
  22. <status>open</status>
  23. <hours>
  24. <hour>
  25. <from>8:30am</from>
  26. <to>12am</to>
  27. </hour>
  28. </hours>
  29. </times>
  30. <date>2018-09-24</date>
  31. <rendered>8:30am - 12am</rendered>
  32. </Monday>
  33. <Tuesday>
  34. <times>
  35. <currently_open>false</currently_open>
  36. <status>open</status>
  37. <hours>
  38. <hour>
  39. <from>8:30am</from>
  40. <to>12am</to>
  41. </hour>
  42. </hours>
  43. </times>
  44. <date>2018-09-25</date>
  45. <rendered>8:30am - 12am</rendered>
  46. </Tuesday>
  47. <Wednesday>
  48. <times>
  49. <currently_open>true</currently_open>
  50. <status>open</status>
  51. <hours>
  52. <hour>
  53. <from>8:30am</from>
  54. <to>12am</to>
  55. </hour>
  56. </hours>
  57. </times>
  58. <date>2018-09-26</date>
  59. <rendered>8:30am - 12am</rendered>
  60. </Wednesday>
  61. <Thursday>
  62. <times>
  63. <currently_open>false</currently_open>
  64. <status>open</status>
  65. <hours>
  66. <hour>
  67. <from>8:30am</from>
  68. <to>12am</to>
  69. </hour>
  70. </hours>
  71. </times>
  72. <date>2018-09-27</date>
  73. <rendered>8:30am - 12am</rendered>
  74. </Thursday>
  75. <Friday>
  76. <times>
  77. <currently_open>false</currently_open>
  78. <status>open</status>
  79. <hours>
  80. <hour>
  81. <from>8:30am</from>
  82. <to>12am</to>
  83. </hour>
  84. </hours>
  85. </times>
  86. <date>2018-09-28</date>
  87. <rendered>8:30am - 12am</rendered>
  88. </Friday>
  89. <Saturday>
  90. <times>
  91. <currently_open>false</currently_open>
  92. <status>open</status>
  93. <hours>
  94. <hour>
  95. <from>10am</from>
  96. <to>6pm</to>
  97. </hour>
  98. </hours>
  99. </times>
  100. <date>2018-09-29</date>
  101. <rendered>10am - 6pm</rendered>
  102. </Saturday>
  103. </week>
  104. </weeks>
  105. </location>
  106.  
  107. String URLString = "https://api3.libcal.com/api_hours_grid.php?iid=4246&format=xml&weeks=1&systemTime=0";
  108. XDocument xdoc = new XDocument();
  109. xdoc = XDocument.Load(URLString);
  110.  
  111. var location = (from p in xdoc.Descendants("location")
  112. from s in p.Descendants("week").Elements()
  113. //from l in p.Descendants().Where( l => l.Ends)
  114. select new
  115. {
  116. CampusName = (string)p.Element("name"),
  117. WeekD = (string)s.Element("date"),
  118. OpenHours = (string)s.Element("rendered"),
  119. //D = p.Descendants("week").Where(z => p.Element.EndsWith("day"))
  120.  
  121. }).ToList();
Add Comment
Please, Sign In to add comment