/usr/bin/stag-findsubtree is in libdata-stag-perl 0.11-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use Data::Stag qw(:all);
use Getopt::Long;
use strict;
use Carp;
use Data::Stag qw(:all);
use Getopt::Long;
my $parser = "";
my $handler = "";
my $mapf;
my $tosql;
my $toxml;
my $toperl;
my $debug;
my $help;
my @interpose = ();
my @regexps = ();
my @delete = ();
my @add = ();
my $lc;
my $merge;
GetOptions(
"help|h"=>\$help,
"parser|format|p=s" => \$parser,
"handler|writer|w=s" => \$handler,
"interpose|i=s@" => \@interpose,
"add|a=s@" => \@add,
"delete|d=s@" => \@delete,
"regexp|re|r=s@"=> \@regexps,
"xml"=>\$toxml,
"perl"=>\$toperl,
"lc"=>\$lc,
"debug"=>\$debug,
"merge=s"=>\$merge,
);
if ($help) {
system("perldoc $0");
exit 0;
}
my $e = shift @ARGV;
my @files = @ARGV;
foreach my $fn (@files) {
my $tree = Data::Stag->parse($fn);
my @subtrees = $tree->find($e);
print $_->xml foreach (@subtrees);
}
__END__
=head1 NAME
stag-findsubtree - finds nodes in a stag file
=head1 SYNOPSIS
stag-findsubtree 'person/name' file.xml
=head1 DESCRIPTION
parses in an input file and writes out subnodes
=head1 USAGE
stag-findsubtree [-p PARSER] [-w WRITER] NODE FILE
=head1 ARGUMENTS
=over
=item -p|parser FORMAT
FORMAT is one of xml, sxpr or itext, or the name of a perl module
xml assumed as default
=item -w|writer FORMAT
FORMAT is one of xml, sxpr or itext, or the name of a perl module
=item NODE
the name of the node/element
=back
=head1 LIMITATIONS
not event based
=head1 SEE ALSO
L<Data::Stag>
=cut
|