RFC: Attributes and XML-RPC
Mark Nutter
mnutter at fore.com
Thu Sep 23 19:15:47 BST 1999
At 02:12 PM 09/22/99 -0600, Blair Murri wrote:
>There is a problem with the perl script that you wrote. The attrib.xml
>version contains the words from the dicionary, but the child.xml doesn't
>(unless my mail server dropped a line).
>
>I don't have time to re-run your test yet, but it would be interesting to
>see what happens when the test is fair.
Doh! "Code in haste, debug in leisure." Ok, here are the corrected
results:
$ ./make.pl
$ ls -l
total 14206
-rw-rw-r-- 1 mnutter mnutter 5811846 Sep 23 08:28 attrib.xml
-rw-rw-r-- 1 mnutter mnutter 8672170 Sep 23 08:28 child.xml
-rwxr-xr-x 1 mnutter mnutter 999 Sep 23 08:26 make.pl
-rwxr-xr-x 1 mnutter mnutter 976 Sep 22 13:16 make.pl~
$ gzip attrib.xml
$ gzip child.xml
$ ls -l
total 1332
-rw-rw-r-- 1 mnutter mnutter 670757 Sep 23 08:28 attrib.xml.gz
-rw-rw-r-- 1 mnutter mnutter 681080 Sep 23 08:28 child.xml.gz
-rwxr-xr-x 1 mnutter mnutter 999 Sep 23 08:26 make.pl
-rwxr-xr-x 1 mnutter mnutter 976 Sep 22 13:16 make.pl~
So child.xml.gz is slightly larger than attrib.xml.gz (about 1.5%, assuming
my math isn't as bad as my coding).
Here again, for reference, is my (corrected) perl script.
#!/usr/bin/perl
open WORDS, "</usr/dict/words" or die "Couldn't open dictionary.\n";
open ATTRIB, ">attrib.xml" or die "Couldn't open attrib.xml\n";
open CHILD, ">child.xml" or die "Couldn't open child.xml\n";
@twenty_strings = qw(one two three four five six seven eight nine ten
eleven twelve thirteen fourteen fifteen sixteen
seventeen eighteen nineteen twenty);
print ATTRIB "<attrib>\n";
print CHILD "<child>\n";
while($word = <WORDS>)
{
$time = time();
$timestr = localtime($time);
$twenty = rand % 20;
$twentystr = $twenty_strings[$twenty];
print ATTRIB <<EOM;
<word time="$time" timestr="$timestr" twenty="$twenty"
twentystr="$twentystr">$word</word>
EOM
print CHILD <<EOM;
<word>
<time>$time</time>
<timestr>$timestr</timestr>
<twenty>$twenty</twenty>
<twentystr>$twentystr</twentystr>
<data>$word</data>
</word>
EOM
}
print ATTRIB "</attrib>\n";
print CHILD "</child>\n";
close CHILD;
close ATTRIB;
close WORDS;
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Mark Nutter, <mnutter at fore.com>
Internet Applications Developer
FORE Systems
Some people are atheists 'til the day they die.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ic.ac.uk/pipermail/xml-dev/attachments/19990923/1b53b4ea/attachment.htm
More information about the Xml-dev
mailing list