Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. entry_212_CA60CTF_2014-10-30_12-14-57.jpg
  2.  
  3. <?xml version="1.0"?>
  4. <Incidents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Count="3" Date="2014-10-30" Time="12:14:57" FileName="2014-10-30_dones_Hillsborough_Leisure_Centre.xml">
  5. <Incident>
  6. <Contract>18</Contract>
  7. <SerialNo>0000000001</SerialNo>
  8. <EntryTime>2014-08-16T08:54:12</EntryTime>// want to group by this element
  9. <ExitTime>2014-08-16T17:03:51</ExitTime>
  10. <OffenceCode>80</OffenceCode>
  11. <Operator>2HR</Operator>
  12. <Registration>CA60CTF</Registration>
  13. <Location>Hillsborough Leisure Centre</Location>
  14. <Make>N/A</Make>
  15. <Model>N/A</Model>
  16. <Colour>N/A</Colour>
  17. <Comment>Entry Date: Saturday, 16 08 2014 on 08:54:12
  18. Exit Date: Saturday, 16 08 2014 on 17:03:51</Comment>
  19. <Nationality>-1</Nationality>
  20. <Foreign>-1</Foreign>
  21. <Evidence>
  22. <FileName>entry_212_CA60CTF_2014-10-30_12-14-57.jpg</FileName>
  23. <FileDescription>Entry</FileDescription>
  24. </Evidence>
  25. <Evidence>
  26. <FileName>exit_212_CA60CTF_2014-10-30_12-14-57.jpg</FileName>
  27. <FileDescription>Exit</FileDescription>
  28. </Evidence>
  29. <Diplomatic>0</Diplomatic>
  30. </Incident>
  31.  
  32. if(file_exists($xmlFullFilename)) {
  33. $xmlDoc = new DomDocument();
  34. $xmlDoc->load($xmlFullFilename);
  35. $tmp = $xmlDoc->getElementsByTagName("Incidents");
  36. $root = $tmp->item(0);
  37.  
  38. // Get the count
  39. $count = $root->getAttribute("Count");
  40. $count++;
  41. $root->setAttribute("Count", $count);
  42.  
  43.  
  44.  
  45. }
  46. else {
  47. $xmlDoc = new DomDocument('1.0');
  48. logit("Created new DOM");
  49. $root = $xmlDoc->createElement("Incidents");
  50. $root->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
  51. $root->setAttribute("Count", "1");
  52. $root->setAttribute("Date", $today);
  53. $root->setAttribute("Time", $now);
  54. $root->setAttribute("FileName", $xmlFilename);
  55.  
  56. $xmlDoc ->appendChild($root);
  57. $serialString = sprintf("%010d", 1);
  58.  
  59. }
  60.  
  61.  
  62. logit("Creating XML entry");
  63. // Create a new entry
  64. $xmlDoc->formatOutput = true;
  65. $incident = $xmlDoc->createElement("Incident");
  66. $root->appendChild($incident);
  67.  
  68. $tmp = split(" ", $entryTime);
  69. $dateString = $tmp[0] . "T" . $tmp[1];
  70. $entryTimeNode = $xmlDoc->createElement("EntryTime", $dateString);
  71.  
  72. eg:<EntryTime>2014-08-16T08:46:17</EntryTime>...
  73.  
  74. $tmp = split(" ", $entryTime);
  75. $dateString = $tmp[0] . "T" . $tmp[1];
  76. $entryTimeNode = $xmlDoc->createElement("EntryTime", $dateString);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement