• Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • Last Change
  • Annotate
  • Revision Log

root/Xml/Working/listElementsAndAttributes.pl

Revision 42, 0.8 kB (checked in by andrew, 19 months ago)

Changes after consultation.
Adding dummy example files - structure ok, not real data
Adding perl scripts to help with checking element/attribute names

  • Property svn:executable set to *
Line 
1#!/usr/bin/perl
2
3use strict;
4
5my @files = @ARGV;
6#my @files = ("ome.xsd");
7#print `pwd`;
8
9unless( @files ) {
10        print "usage: \n./listElementsAndAttributes.pl *xsd\n";
11        exit;
12}
13
14my @elements;
15my @attributes;
16
17foreach my $file (@files ) {
18        open( FILE, "< $file" )
19                or die "Couldn't open $file";
20        while( my $line = <FILE> ) {
21                chomp $line;
22                if( $line =~ m/<(xsd:)?element[^>*?]name\s*=\s*"(\w+)"/o ) {
23                        push( @elements, $2 );
24                } elsif( $line =~ m/<(xsd:)?attribute[^>*?]name\s*=\s*"(\w+)"/o ) {
25                        push( @attributes, $2 );
26                }
27        }
28        close( FILE );
29}
30
31print "Elements:\n\n";
32foreach my $name ( @elements ) {
33        $name =~ s/([[:upper:]])/ $1/g;
34        print "$name\n";
35}
36print "\n";
37
38print "Attributes:\n";
39foreach my $name ( @attributes ) {
40        $name =~ s/([[:upper:]])/ $1/g;
41        print "$name\n";
42}
43print "\n";
44
Note: See TracBrowser for help on using the browser.

Download in other formats:

  • Plain Text
  • Original Format

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/