(e-mail address removed) (Justin Rodino) wrote in
Here is an example line that will be read in (it might get wrapped,
but you can be assured its always one line):
<ExecutionEnvironment ExecutionContext="Admin" LogonName=""
LogonDomain="" LogonPassword="" Interactive="false"
AllowUserExecution="true" UserNotifyTimeout="false" RunForUsers="First
user who logs in" CanRunWhen="whether or not a user is logged on"
StartWindow="Normal" ScheduleRetry="true" MinConnectionSpeed="0"/>
and if the file is in XML format as you indicate, why not use
XML:
arser?
C:\develop\src\misc>cat txml.pl
#! C:/Perl/bin/perl.exe -w
use diagnostics;
use strict;
use warnings;
use XML:
arser;
my $p = new XML:
arser(Handlers => {Start => \&handle_start});
while(<DATA>) {
$p->parse($_);
}
sub handle_start {
my $Expat = shift;
my $Element = shift;
my ($attr, $val);
while((defined ($attr = shift)) && (defined ($val = shift))) {
print $attr, " = ", '"', $val,'"', "\n";
}
}
__DATA__
<ExecutionEnvironment ExecutionContext="Admin" LogonName=""
LogonDomain="" LogonPassword="" Interactive="false"
AllowUserExecution="true" UserNotifyTimeout="false"
RunForUsers="First user who logs in"
CanRunWhen="whether or not a user is logged on" StartWindow="Normal"
ScheduleRetry="true" MinConnectionSpeed="0"/>
Note that the above is entered as a single line, but wrapped in the
newsreader.
Output:
C:\develop\src\misc>txml.pl
ExecutionContext = "Admin"
LogonName = ""
LogonDomain = ""
LogonPassword = ""
Interactive = "false"
AllowUserExecution = "true"
UserNotifyTimeout = "false"
RunForUsers = "First user who logs in"
CanRunWhen = "whether or not a user is logged on"
StartWindow = "Normal"
ScheduleRetry = "true"
MinConnectionSpeed = "0"