Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- entry_212_CA60CTF_2014-10-30_12-14-57.jpg
- <?xml version="1.0"?>
- <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">
- <Incident>
- <Contract>18</Contract>
- <SerialNo>0000000001</SerialNo>
- <EntryTime>2014-08-16T08:54:12</EntryTime>// want to group by this element
- <ExitTime>2014-08-16T17:03:51</ExitTime>
- <OffenceCode>80</OffenceCode>
- <Operator>2HR</Operator>
- <Registration>CA60CTF</Registration>
- <Location>Hillsborough Leisure Centre</Location>
- <Make>N/A</Make>
- <Model>N/A</Model>
- <Colour>N/A</Colour>
- <Comment>Entry Date: Saturday, 16 08 2014 on 08:54:12
- Exit Date: Saturday, 16 08 2014 on 17:03:51</Comment>
- <Nationality>-1</Nationality>
- <Foreign>-1</Foreign>
- <Evidence>
- <FileName>entry_212_CA60CTF_2014-10-30_12-14-57.jpg</FileName>
- <FileDescription>Entry</FileDescription>
- </Evidence>
- <Evidence>
- <FileName>exit_212_CA60CTF_2014-10-30_12-14-57.jpg</FileName>
- <FileDescription>Exit</FileDescription>
- </Evidence>
- <Diplomatic>0</Diplomatic>
- </Incident>
- if(file_exists($xmlFullFilename)) {
- $xmlDoc = new DomDocument();
- $xmlDoc->load($xmlFullFilename);
- $tmp = $xmlDoc->getElementsByTagName("Incidents");
- $root = $tmp->item(0);
- // Get the count
- $count = $root->getAttribute("Count");
- $count++;
- $root->setAttribute("Count", $count);
- }
- else {
- $xmlDoc = new DomDocument('1.0');
- logit("Created new DOM");
- $root = $xmlDoc->createElement("Incidents");
- $root->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- $root->setAttribute("Count", "1");
- $root->setAttribute("Date", $today);
- $root->setAttribute("Time", $now);
- $root->setAttribute("FileName", $xmlFilename);
- $xmlDoc ->appendChild($root);
- $serialString = sprintf("%010d", 1);
- }
- logit("Creating XML entry");
- // Create a new entry
- $xmlDoc->formatOutput = true;
- $incident = $xmlDoc->createElement("Incident");
- $root->appendChild($incident);
- $tmp = split(" ", $entryTime);
- $dateString = $tmp[0] . "T" . $tmp[1];
- $entryTimeNode = $xmlDoc->createElement("EntryTime", $dateString);
- eg:<EntryTime>2014-08-16T08:46:17</EntryTime>...
- $tmp = split(" ", $entryTime);
- $dateString = $tmp[0] . "T" . $tmp[1];
- $entryTimeNode = $xmlDoc->createElement("EntryTime", $dateString);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement