#!/usr/bin/perl
use strict;
use IO::File;
my $usage = "Usage: $0 types schema [top_element_name]\n";
my $type_fn = shift || die $usage;
my $topdl_fn = shift || die $usage;
my $ename = shift || 'experiment';
my $id_type = "\n";
my $first;
my $v;
my $f = new IO::File($type_fn) || die "Can't open $type_fn: $!\n";
while (<$f>) {
(// .. m##) && do {
$id_type .= $_;
};
}
$id_type .= "\n\n";
$f->close();
$f = new IO::File($topdl_fn) || die "Can't open $topdl_fn: $!\n";
while (<$f>) {
($v = //) && do {
chomp;
if ($v == 1 ) {
print "\n";
print "\n";
}
else { print "$_ "; }
next;
};
m#xmlns:fns="http://www.isi.edu/fedd_types"# && next;
!$first && /# && do {
print "\n";
};
s/[tf]ns://g;
print;
}
$f->close();