Mercurial > hg > lukkari
comparison parsedata.pl @ 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 | 49a329e87367 |
comparison
equal
deleted
inserted
replaced
74:b51ad733b624 | 75:3d9e42477367 |
---|---|
518 | 518 |
519 elsif ($opt_mode eq "xml") { | 519 elsif ($opt_mode eq "xml") { |
520 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n". | 520 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n". |
521 "<timetable>\n". | 521 "<timetable>\n". |
522 " <class>\n". | 522 " <class>\n". |
523 " <general>".join("", map { "<node>".encode_entities($_)."</node>"; } @{$class{"info"}})."</general>\n". | 523 " <general>".join("", map { "<node>".$_."</node>"; } @{$class{"info"}})."</general>\n". |
524 " <info>".join("", map { "<node>".encode_entities(html_collapse($_, 1))."</node>"; } @{$class{"data"}})."</info>\n". | 524 " <info>".join("", map { "<node>".html_collapse($_, 1)."</node>"; } @{$class{"data"}})."</info>\n". |
525 " <maxdays>$maxDays</maxdays>\n". | 525 " <maxdays>$maxDays</maxdays>\n". |
526 " <firsthour>$firstHour</firsthour>\n". | 526 " <firsthour>$firstHour</firsthour>\n". |
527 " <lasthour>$lastHour</lasthour>\n". | 527 " <lasthour>$lastHour</lasthour>\n". |
528 " <totalhours>$totalHours</totalhours>\n". | 528 " <totalhours>$totalHours</totalhours>\n". |
529 " </class>\n"; | 529 " </class>\n"; |
530 | 530 |
531 print " <hours>\n"; | 531 print " <hours>\n"; |
532 my $cid = 0; | |
532 foreach my $chour (@$hourTimes) { | 533 foreach my $chour (@$hourTimes) { |
533 print " <hour><start>".$$chour{"start"}."</start><end>".$$chour{"end"}."</end></hour>\n"; | 534 print " <hour id=\"".$cid."\"><start>".$$chour{"start"}."</start><end>".$$chour{"end"}."</end></hour>\n"; |
535 $cid++; | |
534 } | 536 } |
535 print " </hours>\n\n"; | 537 print " </hours>\n\n"; |
536 | 538 |
537 print " <classes>\n"; | 539 print " <classes>\n"; |
538 foreach my $cid (sort { $a <=> $b } keys %{$hourDefs}) { | 540 foreach $cid (sort { $a <=> $b } keys %{$hourDefs}) { |
539 print " <class id=\"$cid\">".getDataStruct($$hourDefs{$cid}, 0)."</class>\n"; | 541 print " <class id=\"$cid\">".getDataStruct($$hourDefs{$cid}, 0)."</class>\n"; |
540 } | 542 } |
541 print " </classes>\n\n"; | 543 print " </classes>\n\n"; |
542 | 544 |
543 print " <days>\n"; | 545 print " <days>\n"; |