remove the - so it can be read as xml
Solution:
# read XML file
my $filename = 'Finesse.txt';
open $FILE, '<', $filename or die "Can't open file $!";
my $document = do { local $/; <$FILE> };
$document =~ s/^[\- ] //mg;
my $dom = XML::LibXML->load_xml(string => $document);
say "Users in READY mode:";
say " ";
$teller = 0;
foreach my $title ($dom->findnodes('Team/users/User')) {
$status = $title->findvalue('./state');
if ($status eq "READY") {
say 'Naam : ', $title->findvalue('./firstName');
$teller++;
}
}
say "Total = ", $teller;
the below file is created from the output of a website
the finesse.txt
- <Team>
<id>8</id>
<name>OurSupport</name>
<uri>/finesse/api/Team/8</uri>
- <users>
- <User>
<dialogs>/finesse/api/User/C.person/Dialogs</dialogs>
<extension />
<firstName>Caz</firstName>
<lastName>Person</lastName>
<loginId>C.Person</loginId>
<pendingState />
<state>ACTIVE</state>
<stateChangeTime>2019-07-15T19:54:40.846Z</stateChangeTime>
<uri>/finesse/api/User/C.Person</uri>
</User>
</users>
</Team>
thanks for giving hints for the solution.