summaryrefslogtreecommitdiff
path: root/xml.pl.in
diff options
context:
space:
mode:
authorunammx <unammx>2001-06-28 01:33:29 +0000
committerunammx <unammx>2001-06-28 01:33:29 +0000
commita91fc842faf7fe65acf5063c7a2e509acbe0bf35 (patch)
tree59c4b6a190324b9f245c964842102dcc738ab546 /xml.pl.in
parent9be9a4ecf85e578cea44fd38e6e6f13cc637e3d1 (diff)
2001-06-27 Arturo Espinosa Aldama <arturo@ximian.com>
* xml.pl.in (xst_xml_read_file): Code readability. (xst_xml_read_stdin): same, and wait for magic string to stop reading. (xst_xml_scan): readability.
Diffstat (limited to 'xml.pl.in')
-rw-r--r--xml.pl.in49
1 files changed, 38 insertions, 11 deletions
diff --git a/xml.pl.in b/xml.pl.in
index 2e06b9d..ef078c9 100644
--- a/xml.pl.in
+++ b/xml.pl.in
@@ -62,6 +62,12 @@ sub xst_xml_print_begin
}
+sub xst_xml_print_request_end
+{
+ &xst_xml_print_string ("<!-- XST: end of request -->\n");
+}
+
+
sub xst_xml_print_end
{
my ($name) = @_;
@@ -323,27 +329,48 @@ sub xst_xml_scan_recurse
}
-sub xst_xml_scan # (file) If no file specified, reads stdin.
+sub xst_xml_read_file
{
my ($file) = @_;
- my $doc; my @tree; my $i;
+ my ($doc, $i);
local *INPUT_FILE;
+
+ open INPUT_FILE, $file;
+ $doc .= $i while ($i = <INPUT_FILE>);
+ close INPUT_FILE;
- if ($file)
+ return $doc;
+}
+
+
+sub xst_xml_read_stdin
+{
+ my ($i, $doc);
+
+ while (! $i =~ /^<!-- XST: end of request -->$/)
{
- open INPUT_FILE, $file;
- $doc .= $i while ($i = <INPUT_FILE>);
- close INPUT_FILE;
+ $doc .= $i;
+ $i = <STDIN>;
}
- elsif ($xst_input_file eq "")
+
+ return $doc;
+}
+
+
+sub xst_xml_scan # (file) If no file specified, reads stdin.
+{
+ my ($file) = @_;
+ my ($doc, @tree);
+
+ $file = $xst_input_file if $file eq undef;
+
+ if ($file)
{
- $doc .= $i while ($i = <STDIN>);
+ $doc = &xst_xml_read_file ($file);
}
else
{
- open INPUT_FILE, $xst_input_file;
- $doc .= $i while ($i = <INPUT_FILE>);
- close INPUT_FILE;
+ $doc = &xst_xml_read_stdin ();
}
&xst_debug_print_log_to_file ("in.xml", $doc);