changeset 75:3d9e42477367

More improvements in the parsing and XML output.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 24 Oct 2012 07:33:28 +0300
parents b51ad733b624
children d1b65d9903ab
files parsedata.pl update.sh
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/parsedata.pl	Wed Oct 24 07:28:06 2012 +0300
+++ b/parsedata.pl	Wed Oct 24 07:33:28 2012 +0300
@@ -520,8 +520,8 @@
   print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".
   "<timetable>\n".
   " <class>\n".
-  "  <general>".join("", map { "<node>".encode_entities($_)."</node>"; } @{$class{"info"}})."</general>\n".
-  "  <info>".join("", map { "<node>".encode_entities(html_collapse($_, 1))."</node>"; } @{$class{"data"}})."</info>\n".
+  "  <general>".join("", map { "<node>".$_."</node>"; } @{$class{"info"}})."</general>\n".
+  "  <info>".join("", map { "<node>".html_collapse($_, 1)."</node>"; } @{$class{"data"}})."</info>\n".
   "  <maxdays>$maxDays</maxdays>\n".
   "  <firsthour>$firstHour</firsthour>\n".
   "  <lasthour>$lastHour</lasthour>\n".
@@ -529,13 +529,15 @@
   " </class>\n";
 
   print " <hours>\n";
+  my $cid = 0;
   foreach my $chour (@$hourTimes) {
-    print "  <hour><start>".$$chour{"start"}."</start><end>".$$chour{"end"}."</end></hour>\n";
+    print "  <hour id=\"".$cid."\"><start>".$$chour{"start"}."</start><end>".$$chour{"end"}."</end></hour>\n";
+    $cid++;
   }
   print " </hours>\n\n";
 
   print " <classes>\n";
-  foreach my $cid (sort { $a <=> $b } keys %{$hourDefs}) {
+  foreach $cid (sort { $a <=> $b } keys %{$hourDefs}) {
     print "  <class id=\"$cid\">".getDataStruct($$hourDefs{$cid}, 0)."</class>\n";
   }
   print " </classes>\n\n";
--- a/update.sh	Wed Oct 24 07:28:06 2012 +0300
+++ b/update.sh	Wed Oct 24 07:33:28 2012 +0300
@@ -64,6 +64,7 @@
 		fi
 		echo "Parsing $i"
 		perl parsedata.pl -php "$INFILE" -o "${CACHEDIR}${DATAFILE}"
+		perl parsedata.pl -xml "$INFILE" -o "${CACHEDIR}${i}.xml"
 	fi
 done
 fi