XML::Parser Installation error: XML-Parser-2.34

Discussion in 'Perl Misc' started by Sean, Oct 2, 2006.

  1. Sean

    Sean Guest

    I downloaded the XML-Parser module from
    http://search.cpan.org/~msergeant/XML-Parser/Parser.pm
    and I untar the source ball to $HOME/local/XML-Parser-2.34.
    Can someone give me some helps? I appreciate!


    Here is what I did and what errors I got:

    1) sean$cd local/XML-Parser-2.34
    2) XML-Parser-2.34$ ls
    Changes Expat MANIFEST Makefile.PL Parser Parser.pm README blib
    pm_to_blib samples t
    3) XML-Parser-2.34$ perl Makefile.PL PREFIX=$HOME/local/perl
    Writing Makefile for XML::parser::Expat
    Writing Makefile for XML::parse
    4) XML-Parser-2.34$ make
    make[1]: Entering directory `/home/seany/local/XML-Parser-2.34/Expat'
    cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
    -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
    -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.34\" -DXS_VERSION=\"2.34\"
    -fPIC "-I/usr/lib/perl/5.8/CORE" Expat.c
    Expat.xs:12:19: error: expat.h: No such file or directory
    Expat.xs:60: error: syntax error before 'XML_Parser'
    Expat.xs:60: warning: no semicolon at end of struct or union
    Expat.xs:78: error: syntax error before ':' token
    Expat.xs:79: error: syntax error before ':' token
    Expat.xs:80: error: syntax error before ':' token
    Expat.xs:106: error: syntax error before '}' token
    Expat.xs:106: warning: data definition has no type or storage class
    ......(lots of similar errors)
    make[1]: *** [Expat.o] Error 1
    Sean, Oct 2, 2006
    #1
    1. Advertising

  2. Sean

    Sean Guest

    well, I think the C Expat library should be self-contained in this perl
    XML-Parser module. Here is a 'try-to-prove'. I see a Expat.c there.

    XML-Parser-2.34$ cd Expat/
    Expat$ ls
    Expat.c Expat.pm Expat.xs Makefile Makefile.PL encoding.h
    pm_to_blib typemap

    So, the previous question was about why Expat.h was missing.

    Thanks,
    Sean

    Jim Gibson wrote:
    > In article <>,
    > Sean <> wrote:
    >
    > > I downloaded the XML-Parser module from
    > > http://search.cpan.org/~msergeant/XML-Parser/Parser.pm
    > > and I untar the source ball to $HOME/local/XML-Parser-2.34.
    > > Can someone give me some helps? I appreciate!
    > >
    > >
    > > Here is what I did and what errors I got:
    > >
    > > 1) sean$cd local/XML-Parser-2.34
    > > 2) XML-Parser-2.34$ ls
    > > Changes Expat MANIFEST Makefile.PL Parser Parser.pm README blib
    > > pm_to_blib samples t
    > > 3) XML-Parser-2.34$ perl Makefile.PL PREFIX=$HOME/local/perl
    > > Writing Makefile for XML::parser::Expat
    > > Writing Makefile for XML::parse
    > > 4) XML-Parser-2.34$ make
    > > make[1]: Entering directory `/home/seany/local/XML-Parser-2.34/Expat'
    > > cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
    > > -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
    > > -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.34\" -DXS_VERSION=\"2.34\"
    > > -fPIC "-I/usr/lib/perl/5.8/CORE" Expat.c
    > > Expat.xs:12:19: error: expat.h: No such file or directory
    > > Expat.xs:60: error: syntax error before 'XML_Parser'
    > > Expat.xs:60: warning: no semicolon at end of struct or union
    > > Expat.xs:78: error: syntax error before ':' token
    > > Expat.xs:79: error: syntax error before ':' token
    > > Expat.xs:80: error: syntax error before ':' token
    > > Expat.xs:106: error: syntax error before '}' token
    > > Expat.xs:106: warning: data definition has no type or storage class
    > > .....(lots of similar errors)
    > > make[1]: *** [Expat.o] Error 1
    > >

    >
    > Do you have the expat library installed? XML::parser is a Perl wrapper
    > for using the expat C library. Try here: http://expat.sourceforge.net/
    >
    > In the meantime, you can try XML::SAX::purePerl, but it will be much
    > slower than XML::parser and expat.
    Sean, Oct 2, 2006
    #2
    1. Advertising

  3. Sean

    Ben Morrow Guest

    [please don't top-post]

    Quoth "Sean" <>:
    > Jim Gibson wrote:
    > > In article <>,
    > > Sean <> wrote:
    > >
    > > > Here is what I did and what errors I got:
    > > >
    > > > 4) XML-Parser-2.34$ make
    > > > make[1]: Entering directory `/home/seany/local/XML-Parser-2.34/Expat'
    > > > cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
    > > > -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
    > > > -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.34\" -DXS_VERSION=\"2.34\"
    > > > -fPIC "-I/usr/lib/perl/5.8/CORE" Expat.c
    > > > Expat.xs:12:19: error: expat.h: No such file or directory
    > > > Expat.xs:60: error: syntax error before 'XML_Parser'

    > >
    > > Do you have the expat library installed? XML::parser is a Perl wrapper
    > > for using the expat C library. Try here: http://expat.sourceforge.net/
    > >
    > > In the meantime, you can try XML::SAX::purePerl, but it will be much
    > > slower than XML::parser and expat.

    >
    > well, I think the C Expat library should be


    ITYM 'I think it is' rather than 'I think it should be'? In any case, it
    isn't. Did you read the README?

    > self-contained in this perl
    > XML-Parser module. Here is a 'try-to-prove'. I see a Expat.c there.
    >
    > XML-Parser-2.34$ cd Expat/
    > Expat$ ls
    > Expat.c Expat.pm Expat.xs Makefile Makefile.PL encoding.h
    > pm_to_blib typemap
    >
    > So, the previous question was about why Expat.h was missing.


    Expat.h ne expat.h. Filenames are case-sensitive under Unix.

    expat is a lot more than one C file. That Expat.c is produced from
    Expat.xs, and is part of the glue between Perl and expat.

    Now, do you have expat installed somewhere weird so MakeMaker can't find
    it, or do you not have it installed at all?

    Ben

    --
    Raise your hand if you're invulnerable.
    []
    Ben Morrow, Oct 2, 2006
    #3
  4. Sean

    robic0 Guest

    On 2 Oct 2006 11:17:36 -0700, "Sean" <> wrote:

    >I downloaded the XML-Parser module from
    >http://search.cpan.org/~msergeant/XML-Parser/Parser.pm
    >and I untar the source ball to $HOME/local/XML-Parser-2.34.
    >Can someone give me some helps? I appreciate!
    >
    >

    <snip>

    Just some cut & paste to hopefully get you on track.....
    --------------

    Using AS Perl:
    Its been a couple of years and I can't remeber exactly but
    I think all of this is available in the repository and auto
    installs using ppm.
    Installing Xerces however, is a different thing.
    Its great for schema checking. I've only installed it for win32
    platform.

    After install, my perl docs look like this:

    XML
    NamespaceSupport
    Parser
    Expat
    Lite
    Style
    Debug
    Objects
    Stream
    Subs
    Tree
    SAX
    Base
    DocumentLocator
    Exception
    Intro
    ParserFactory
    PurePerl
    Reader
    Simple
    FAQ

    Don't use SAX, its slower than drying paint.
    Eventually you should be able to do this:
    ------------------------------------------------
    use XML::Xerces;

    use XML::parser::Expat;
    use XML::Simple;
    $XML::Simple::pREFERRED_PARSER = 'XML::parser';
    #use Data::Dumper;

    ## Loop through some file list
    next if (!ValidateSchema ($fullname));
    #open the file

    ## Parse xml and integrity check
    my $parser = new XML::parser::Expat;
    $parser->setHandlers('Start' => \&stag_h,
    'End' => \&etag_h,
    'Char' => \&cdata_h);
    $parser->setHandlers('Comment' => \&comment_h) if (clog);

    eval {$parser->parse(*SAMP)};
    if ($@) {
    ## xml integrity failed -log this error
    $@ =~ s/^[\x20\n\t]+//; $@ =~ s/[\x20\n\t]+$//;
    # attempt strip off program line,col info at end
    $@ =~ s/(at line [0-9]+,.+)?at .+ line [0-9]+$/$1/;
    reporterror($@, $XML_File);
    }
    close(SAMP);
    $parser->release;


    ##
    ##
    sub ValidateSchema {
    my ($xfile) = @_;
    #my $valerr = 0;

    # Docs: http://xml.apache.org/xerces-c/apiDocs/classAbstractDOMParser.html#z869_9
    my $Xparser = XML::Xerces::XercesDOMParser->new();
    $Xparser->setValidationScheme(1);
    $Xparser->setDoNamespaces(1);
    $Xparser->setDoSchema(1);
    #$Xparser->setValidationSchemaFullChecking(1); # full constraint (if enabled, may be time-consuming)

    $Xparser->setExternalNoNamespaceSchemaLocation($hVdef{'Schema'});

    my $ERROR_HANDLER = XLoggingErrorHandler->new(\&LogX_warn, \&LogX_error, \&LogX_ferror, );
    #my $ERROR_HANDLER = XML::Xerces::perlErrorHandler->new();
    $Xparser->setErrorHandler($ERROR_HANDLER);

    eval {$Xparser->parse (XML::Xerces::LocalFileInputSource->new($xfile));};
    ## this not to be used ...
    if ($@) {
    # if (ref $@) {
    # my $msg = $@->getMessage();
    # $msg =~ s/^[\x20\n\t]+//; $msg =~ s/[\x20\n\t]+$//;
    # LogInfo ($msg,1,0);
    # } else {
    # die $@;
    # $@ =~ s/^[\x20\n\t]+//; $@ =~ s/[\x20\n\t]+$//;
    # LogInfo ("$@",1,0);
    # }
    # $valerr = 1;
    }
    return 1;
    }
    ##
    ## Error logging callbacks for Xlogging class
    ##
    sub LogX_warn {...}
    sub LogX_error {...}
    sub LogX_ferror{...}


    ################################################################################
    ## Custom Error logging handler CLASS for Xerces
    ## (not alot of docs for this, just pass the message to the callers log handlers)
    ##
    package XLoggingErrorHandler;
    #use Carp;
    use vars qw(@ISA);
    @ISA = qw();
    sub new {
    my $class = shift;
    my $self = {};
    $self->{'Warnlog_h'} = shift;
    $self->{'Errlog_h'} = shift;
    $self->{'Ferrlog_h'} = shift;
    return bless $self, $class;
    }
    sub warning
    {
    my ($self, $iref) = @_;
    if (defined $self->{'Warnlog_h'}) {
    $self->{'Warnlog_h'}(fmt_msg($iref));
    } else {
    print "No warning msg handler for msg: ".fmt_msg($iref)."\n";
    die ("no msg");
    }
    }
    sub error
    {
    my ($self, $iref) = @_;
    if (defined $self->{'Errlog_h'}) {
    $self->{'Errlog_h'}(fmt_msg($iref));
    } else {
    print "No error msg handler for msg: ".fmt_msg($iref)."\n";
    }
    die ("no msg");
    }
    sub fatal_error
    {
    my ($self, $iref) = @_;
    if (defined $self->{'Ferrlog_h'}) {
    $self->{'Ferrlog_h'}(fmt_msg($iref));
    } else {
    print "No fatal error msg handler for msg: ".fmt_msg($iref)."\n";
    }
    die ("no msg");
    }
    sub reset_errors {}
    sub fmt_msg
    {
    my $iref = shift;
    #return ($iref->getLineNumber.", ".$iref->getColumnNumber.": ".$iref->getMessage);
    return ($iref->getMessage." at line ".$iref->getLineNumber.", column ".$iref->getColumnNumber);
    }


    -------------------------------------------
    This goes on the top of your program.
    This is a general block to get Perl2Exe to work with this:

    ## Utf8 bug workaround; Force RE to load.
    ## Notice- this generates warnings only when running the exe
    ## if not compiled with warnings off. Go into \perl\lib\utf8_heavy.pl
    ## and comment "#use warnings", then use P2e to build it.
    eval { XMLin( '<hell>hy</hell>' , SuppressEmpty => '') };

    OR just turn it off for that module ?

    #=====================================================
    # For Perl2Exe 8.60 - Win32
    #
    my $P2E = ($^X =~ /(perl)|(perl\.exe)$/i) ? 0 : 1;
    my $progname = $P2E ? "myprog.exe" : "perl myprog.pl";
    $0 = $^X unless ($^X =~ m%(^|[/\\])(perl)|(perl.exe)$%i);
    my ($progdir) = $0 =~ m%^(.*)[/\\]%;
    $progdir ||= ".";# if (length($progdir)>0);

    #use XML::NamespaceSupport; # uncomment for P2x binary
    #use XML::parser::Style::Tree; # uncomment for P2x binary
    #use bytes; # uncomment for P2x binary
    #use File::Glob ':glob'; # uncomment for P2x binary

    #perl2exe_include "utf8_heavy.pl";
    #require "unicore/lib/SpacePer.pl";
    #perl2exe_include "unicore/To/Lower.pl";
    #perl2exe_include "unicore/To/Upper.pl";
    #perl2exe_include "unicore/To/Fold.pl";
    #require "unicore/lib/Digit.pl";
    #require "unicore/lib/Word.pl";
    #perl2exe_include "Encode/Unicode.pm";

    #perl2exe_info FileVersion=1.0.0.0
    #perl2exe_info CompanyName=
    #perl2exe_info FileDescription=
    #perl2exe_info InternalName=
    #perl2exe_info LegalCopyright=
    #perl2exe_info LegalTrademarks=
    #perl2exe_info OriginalFilename=myprog.exe
    #perl2exe_info ProductName=
    #perl2exe_info ProductVersion=
    #
    #=====================================================
    robic0, Oct 3, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HarishN
    Replies:
    4
    Views:
    221
    Anno Siegel
    Feb 23, 2004
  2. Abhinav
    Replies:
    3
    Views:
    115
    Abhinav
    May 28, 2004
  3. arne
    Replies:
    0
    Views:
    342
  4. Erik Wasser
    Replies:
    5
    Views:
    428
    Peter J. Holzer
    Mar 5, 2006
  5. Sean
    Replies:
    0
    Views:
    358
Loading...

Share This Page