common/tools/raptor/XML/SAX.pm
author Shabe Razvi <shaber@symbian.org>
Wed, 06 Jan 2010 22:30:41 +0000
changeset 838 a1ebf7f8e66f
parent 307 989c70555820
permissions -rw-r--r--
Move gcc into tools_epoc.zip so that syborg/beagle rom building works during build from source only.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
307
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     1
# $Id: SAX.pm,v 1.27 2007/02/07 09:33:50 grant Exp $
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     2
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     3
package XML::SAX;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     4
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     5
use strict;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     6
use vars qw($VERSION @ISA @EXPORT_OK);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     7
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     8
$VERSION = '0.15';
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
     9
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    10
use Exporter ();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    11
@ISA = ('Exporter');
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    12
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    13
@EXPORT_OK = qw(Namespaces Validation);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    14
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    15
use File::Basename qw(dirname);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    16
use File::Spec ();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    17
use Symbol qw(gensym);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    18
use XML::SAX::ParserFactory (); # loaded for simplicity
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    19
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    20
use constant PARSER_DETAILS => "ParserDetails.ini";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    21
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    22
use constant Namespaces => "http://xml.org/sax/features/namespaces";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    23
use constant Validation => "http://xml.org/sax/features/validation";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    24
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    25
my $known_parsers = undef;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    26
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    27
# load_parsers takes the ParserDetails.ini file out of the same directory
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    28
# that XML::SAX is in, and looks at it. Format in POD below
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    29
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    30
=begin EXAMPLE
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    31
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    32
[XML::SAX::PurePerl]
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    33
http://xml.org/sax/features/namespaces = 1
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    34
http://xml.org/sax/features/validation = 0
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    35
# a comment
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    36
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    37
# blank lines ignored
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    38
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    39
[XML::SAX::AnotherParser]
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    40
http://xml.org/sax/features/namespaces = 0
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    41
http://xml.org/sax/features/validation = 1
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    42
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    43
=end EXAMPLE
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    44
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    45
=cut
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    46
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    47
sub load_parsers {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    48
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    49
    my $dir = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    50
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    51
    # reset parsers
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    52
    $known_parsers = [];
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    53
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    54
    # get directory from wherever XML::SAX is installed
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    55
    if (!$dir) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    56
        $dir = $INC{'XML/SAX.pm'};
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    57
        $dir = dirname($dir);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    58
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    59
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    60
    my $fh = gensym();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    61
    if (!open($fh, File::Spec->catfile($dir, "SAX", PARSER_DETAILS))) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    62
        XML::SAX->do_warn("could not find " . PARSER_DETAILS . " in $dir/SAX\n");
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    63
        return $class;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    64
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    65
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    66
    $known_parsers = $class->_parse_ini_file($fh);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    67
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    68
    return $class;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    69
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    70
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    71
sub _parse_ini_file {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    72
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    73
    my ($fh) = @_;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    74
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    75
    my @config;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    76
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    77
    my $lineno = 0;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    78
    while (defined(my $line = <$fh>)) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    79
        $lineno++;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    80
        my $original = $line;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    81
        # strip whitespace
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    82
        $line =~ s/\s*$//m;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    83
        $line =~ s/^\s*//m;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    84
        # strip comments
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    85
        $line =~ s/[#;].*$//m;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    86
        # ignore blanks
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    87
        next if $line =~ /^$/m;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    88
        
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    89
        # heading
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    90
        if ($line =~ /^\[\s*(.*)\s*\]$/m) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    91
            push @config, { Name => $1 };
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    92
            next;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    93
        }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    94
        
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    95
        # instruction
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    96
        elsif ($line =~ /^(.*?)\s*?=\s*(.*)$/) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    97
            unless(@config) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    98
                push @config, { Name => '' };
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
    99
            }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   100
            $config[-1]{Features}{$1} = $2;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   101
        }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   102
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   103
        # not whitespace, comment, or instruction
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   104
        else {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   105
            die "Invalid line in ini: $lineno\n>>> $original\n";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   106
        }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   107
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   108
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   109
    return \@config;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   110
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   111
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   112
sub parsers {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   113
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   114
    if (!$known_parsers) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   115
        $class->load_parsers();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   116
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   117
    return $known_parsers;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   118
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   119
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   120
sub remove_parser {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   121
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   122
    my ($parser_module) = @_;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   123
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   124
    if (!$known_parsers) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   125
        $class->load_parsers();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   126
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   127
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   128
    @$known_parsers = grep { $_->{Name} ne $parser_module } @$known_parsers;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   129
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   130
    return $class;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   131
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   132
 
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   133
sub add_parser {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   134
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   135
    my ($parser_module) = @_;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   136
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   137
    if (!$known_parsers) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   138
        $class->load_parsers();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   139
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   140
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   141
    # first load module, then query features, then push onto known_parsers,
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   142
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   143
    my $parser_file = $parser_module;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   144
    $parser_file =~ s/::/\//g;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   145
    $parser_file .= ".pm";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   146
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   147
    require $parser_file;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   148
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   149
    my @features = $parser_module->supported_features();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   150
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   151
    my $new = { Name => $parser_module };
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   152
    foreach my $feature (@features) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   153
        $new->{Features}{$feature} = 1;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   154
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   155
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   156
    # If exists in list already, move to end.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   157
    my $done = 0;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   158
    my $pos = undef;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   159
    for (my $i = 0; $i < @$known_parsers; $i++) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   160
        my $p = $known_parsers->[$i];
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   161
        if ($p->{Name} eq $parser_module) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   162
            $pos = $i;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   163
        }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   164
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   165
    if (defined $pos) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   166
        splice(@$known_parsers, $pos, 1);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   167
        push @$known_parsers, $new;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   168
        $done++;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   169
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   170
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   171
    # Otherwise (not in list), add at end of list.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   172
    if (!$done) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   173
        push @$known_parsers, $new;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   174
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   175
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   176
    return $class;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   177
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   178
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   179
sub save_parsers {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   180
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   181
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   182
    # get directory from wherever XML::SAX is installed
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   183
    my $dir = $INC{'XML/SAX.pm'};
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   184
    $dir = dirname($dir);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   185
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   186
    my $file = File::Spec->catfile($dir, "SAX", PARSER_DETAILS);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   187
    chmod 0644, $file;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   188
    unlink($file);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   189
    
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   190
    my $fh = gensym();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   191
    open($fh, ">$file") ||
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   192
        die "Cannot write to $file: $!";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   193
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   194
    foreach my $p (@$known_parsers) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   195
        print $fh "[$p->{Name}]\n";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   196
        foreach my $key (keys %{$p->{Features}}) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   197
            print $fh "$key = $p->{Features}{$key}\n";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   198
        }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   199
        print $fh "\n";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   200
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   201
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   202
    print $fh "\n";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   203
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   204
    close $fh;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   205
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   206
    return $class;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   207
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   208
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   209
sub do_warn {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   210
    my $class = shift;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   211
    # Don't output warnings if running under Test::Harness
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   212
    warn(@_) unless $ENV{HARNESS_ACTIVE};
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   213
}
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   214
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   215
1;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   216
__END__
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   217
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   218
=head1 NAME
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   219
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   220
XML::SAX - Simple API for XML
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   221
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   222
=head1 SYNOPSIS
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   223
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   224
  use XML::SAX;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   225
  
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   226
  # get a list of known parsers
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   227
  my $parsers = XML::SAX->parsers();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   228
  
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   229
  # add/update a parser
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   230
  XML::SAX->add_parser(q(XML::SAX::PurePerl));
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   231
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   232
  # remove parser
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   233
  XML::SAX->remove_parser(q(XML::SAX::Foodelberry));
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   234
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   235
  # save parsers
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   236
  XML::SAX->save_parsers();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   237
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   238
=head1 DESCRIPTION
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   239
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   240
XML::SAX is a SAX parser access API for Perl. It includes classes
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   241
and APIs required for implementing SAX drivers, along with a factory
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   242
class for returning any SAX parser installed on the user's system.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   243
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   244
=head1 USING A SAX2 PARSER
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   245
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   246
The factory class is XML::SAX::ParserFactory. Please see the
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   247
documentation of that module for how to instantiate a SAX parser:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   248
L<XML::SAX::ParserFactory>. However if you don't want to load up
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   249
another manual page, here's a short synopsis:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   250
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   251
  use XML::SAX::ParserFactory;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   252
  use XML::SAX::XYZHandler;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   253
  my $handler = XML::SAX::XYZHandler->new();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   254
  my $p = XML::SAX::ParserFactory->parser(Handler => $handler);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   255
  $p->parse_uri("foo.xml");
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   256
  # or $p->parse_string("<foo/>") or $p->parse_file($fh);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   257
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   258
This will automatically load a SAX2 parser (defaulting to
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   259
XML::SAX::PurePerl if no others are found) and return it to you.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   260
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   261
In order to learn how to use SAX to parse XML, you will need to read
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   262
L<XML::SAX::Intro> and for reference, L<XML::SAX::Specification>.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   263
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   264
=head1 WRITING A SAX2 PARSER
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   265
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   266
The first thing to remember in writing a SAX2 parser is to subclass
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   267
XML::SAX::Base. This will make your life infinitely easier, by providing
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   268
a number of methods automagically for you. See L<XML::SAX::Base> for more
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   269
details.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   270
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   271
When writing a SAX2 parser that is compatible with XML::SAX, you need
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   272
to inform XML::SAX of the presence of that driver when you install it.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   273
In order to do that, XML::SAX contains methods for saving the fact that
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   274
the parser exists on your system to a "INI" file, which is then loaded
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   275
to determine which parsers are installed.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   276
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   277
The best way to do this is to follow these rules:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   278
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   279
=over 4
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   280
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   281
=item * Add XML::SAX as a prerequisite in Makefile.PL:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   282
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   283
  WriteMakefile(
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   284
      ...
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   285
      PREREQ_PM => { 'XML::SAX' => 0 },
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   286
      ...
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   287
  );
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   288
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   289
Alternatively you may wish to check for it in other ways that will
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   290
cause more than just a warning.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   291
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   292
=item * Add the following code snippet to your Makefile.PL:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   293
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   294
  sub MY::install {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   295
    package MY;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   296
    my $script = shift->SUPER::install(@_);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   297
    if (ExtUtils::MakeMaker::prompt(
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   298
      "Do you want to modify ParserDetails.ini?", 'Y')
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   299
      =~ /^y/i) {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   300
      $script =~ s/install :: (.*)$/install :: $1 install_sax_driver/m;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   301
      $script .= <<"INSTALL";
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   302
  
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   303
  install_sax_driver :
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   304
  \t\@\$(PERL) -MXML::SAX -e "XML::SAX->add_parser(q(\$(NAME)))->save_parsers()"
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   305
  
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   306
  INSTALL
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   307
    }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   308
    return $script;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   309
  }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   310
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   311
Note that you should check the output of this - \$(NAME) will use the name of
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   312
your distribution, which may not be exactly what you want. For example XML::LibXML
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   313
has a driver called XML::LibXML::SAX::Generator, which is used in place of
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   314
\$(NAME) in the above.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   315
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   316
=item * Add an XML::SAX test:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   317
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   318
A test file should be added to your t/ directory containing something like the
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   319
following:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   320
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   321
  use Test;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   322
  BEGIN { plan tests => 3 }
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   323
  use XML::SAX;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   324
  use XML::SAX::PurePerl::DebugHandler;
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   325
  XML::SAX->add_parser(q(XML::SAX::MyDriver));
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   326
  local $XML::SAX::ParserPackage = 'XML::SAX::MyDriver';
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   327
  eval {
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   328
    my $handler = XML::SAX::PurePerl::DebugHandler->new();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   329
    ok($handler);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   330
    my $parser = XML::SAX::ParserFactory->parser(Handler => $handler);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   331
    ok($parser);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   332
    ok($parser->isa('XML::SAX::MyDriver');
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   333
    $parser->parse_string("<tag/>");
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   334
    ok($handler->{seen}{start_element});
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   335
  };
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   336
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   337
=back
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   338
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   339
=head1 EXPORTS
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   340
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   341
By default, XML::SAX exports nothing into the caller's namespace. However you
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   342
can request the symbols C<Namespaces> and C<Validation> which are the
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   343
URIs for those features, allowing an easier way to request those features
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   344
via ParserFactory:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   345
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   346
  use XML::SAX qw(Namespaces Validation);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   347
  my $factory = XML::SAX::ParserFactory->new();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   348
  $factory->require_feature(Namespaces);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   349
  $factory->require_feature(Validation);
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   350
  my $parser = $factory->parser();
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   351
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   352
=head1 AUTHOR
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   353
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   354
Current maintainer: Grant McLean, grantm@cpan.org
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   355
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   356
Originally written by:
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   357
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   358
Matt Sergeant, matt@sergeant.org
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   359
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   360
Kip Hampton, khampton@totalcinema.com
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   361
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   362
Robin Berjon, robin@knowscape.com
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   363
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   364
=head1 LICENSE
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   365
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   366
This is free software, you may use it and distribute it under
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   367
the same terms as Perl itself.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   368
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   369
=head1 SEE ALSO
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   370
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   371
L<XML::SAX::Base> for writing SAX Filters and Parsers
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   372
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   373
L<XML::SAX::PurePerl> for an XML parser written in 100%
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   374
pure perl.
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   375
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   376
L<XML::SAX::Exception> for details on exception handling
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   377
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   378
=cut
989c70555820 raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff changeset
   379