From: Andreas Neiser Date: Thu, 27 Jun 2013 14:48:37 +0000 (+0200) Subject: Simple but documented xml-db.pl added, some file renaming and indenting X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=fce63b518d61ced6e83df42380646ded56abfec1;p=daqtools.git Simple but documented xml-db.pl added, some file renaming and indenting --- diff --git a/xml-db/database/TrbNetspec.xsd b/xml-db/database/TrbNet.xsd similarity index 100% rename from xml-db/database/TrbNetspec.xsd rename to xml-db/database/TrbNet.xsd diff --git a/xml-db/database/first-idea.xml b/xml-db/database/first-idea.xml deleted file mode 100644 index 71d0eab..0000000 --- a/xml-db/database/first-idea.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - -Start initialization sequence for all connected sensor chains - - - Reserved, Not Used - - - - \ No newline at end of file diff --git a/xml-db/database/jtag_registers_SPEC.xml b/xml-db/database/jtag_registers_SPEC.xml deleted file mode 100644 index 7e55c93..0000000 --- a/xml-db/database/jtag_registers_SPEC.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Wait time between write sequence and start signal. - - The number of MAPS clock cycles to wait after last write before sending the start signal. - - - - - \ No newline at end of file diff --git a/xml-db/database/testing.xml b/xml-db/database/testing.xml new file mode 100644 index 0000000..2619fb8 --- /dev/null +++ b/xml-db/database/testing.xml @@ -0,0 +1,32 @@ + + + + + + Wait time between write sequence and start signal. + + The number of MAPS clock cycles to wait after last write before sending the start signal. + + + + diff --git a/xml-db/xml-db.pl b/xml-db/xml-db.pl new file mode 100755 index 0000000..abc6cb3 --- /dev/null +++ b/xml-db/xml-db.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use XML::LibXML; +use Getopt::Long; +use Pod::Usage; +use FindBin qw($RealBin); +use Data::Dumper; + +# some default config options +# and provide nice help documentation + +my $man = 0; +my $help = 0; +my $verbose = 0; +my $db_dir = "$RealBin/database"; + +GetOptions( + 'help|h' => \$help, + 'man' => \$man, + 'verbose|v+' => \$verbose + ) or pod2usage(2); +pod2usage(1) if $help; +pod2usage(-exitval => 0, -verbose => 2) if $man; + +print "Database: $db_dir\n" if $verbose; + +my $doc = XML::LibXML->new->parse_file("$db_dir/testing.xml"); +my $xmlschema = XML::LibXML::Schema->new( location => "$db_dir/TrbNet.xsd" ); + +$xmlschema->validate($doc); + +__END__ + +=head1 NAME + +xml-db.pl - Access the TRB XML Database + +=head1 SYNOPSIS + +xml-db.pl [options] [config file] + + Options: + -h, --help brief help message + --xml-db_dir database directory + +=head1 OPTIONS + +=over 8 + +=item B<--help> + +Print a brief help message and exits. + +=item B<--db-dir> + +Set the database directory where the default XML files can be found. + +=back + +=head1 DESCRIPTION + +B provides basic access to the XML database describing +the TRB registers. + +=cut