ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
cgi app broken after upgrading XML::DOM and XML::Parser modules
by Mike Glen other posts by this author
Jul 28 2005 8:20AM messages near this date
view in the new Beta List Site
Re: XML::XPath in Win32 World | LibXML: Validating Schema using LibXML
& XSLT Hi perl XML gurus,

On my develoment server the perl modules XML::DOM and XML::Parser were 
recently upgrade after the next restart of Apache the cgi application 
running on the server stopped working.The app was written several years 
ago (not by me) and has had no problems with its operation until this 
happened.

The modules were upgraded from 1.42 to 1.43 (XML::DOM) and 2.31 to 2.34 
(XML::Parser)

I have tried to reinstall the old versions of the modules by simply 
reinstalling them ove the top of the newer versions (I am not a perl 
expert and was advised that i could do it like this) but errors 
continued to occur. I have also tried reinstalling the application 
specific code and rebuilding the database  This appeared to solve some 
problems but errors are still occuring.

The app subclasses XML::DOM::CDATASection so that on printing and XML 
document, using toString(), CDATA sections are output without the 
![CDATA[ ]]. have listed most of the code for this below.

BEGIN
{
    import XML::DOM::Node;
}

use Exporter;
use DBI;

use vars qw($VERSION @ISA @EXPORT_OK);

use Web4Test::Error qw(IsError GetLastError);
use Web4Test::Util::Logger qw(w4t_log);

@EXPORT_OK = qw(getConnection executeQuery executeInsertQuery);

@ISA = qw(Exporter XML::DOM::CDATASection);

sub new
{
    my ($class, $doc, $data) = @_;
    if ($doc-> getNodeType() != XML::DOM::DOCUMENT_NODE){
                $doc = $doc-> getOwnerDocument();
        }
    bless {Doc  =>  $doc, Data => $data}, $class;
}

sub cloneNode
{
    my $self = shift;
    return new Web4Test::DOM::CDATASection($self-> {Doc},$self->getData);
}

sub print
{
    my ($self, $FILE) = @_;
    $FILE-> print (XML::DOM::encodeCDATA ($self->getData));
}
                                                                                            
     


According to the error logs the problem seems to occur when the app 
tries to setOwnerDocument() in XML::DOM in the following method

sub ReplaceNode {
        my $oldnode = shift;
        my $newnode = shift;

        my $parent = $oldnode-> getParentNode();

        my $olddoc = $oldnode-> getOwnerDocument();

        #I want to use the DOCUMENT_ELEMENT constant but strict complains
        #just disable it here
        no strict 'subs';

        if ($newnode-> getNodeType() == DOCUMENT_NODE){
                $newnode = CreateFragment($newnode-> getDocumentElement());
        }
        $newnode-> setOwnerDocument($olddoc);
        $parent-> replaceChild($newnode,$oldnode);
}


newnode is a Web4Test::DOM::CDATASection (subclass of 
XML::DOM::CDATASection code shown above)
olddoc is a XML::DOM::Document

Error message in the apache logs is:

 [error] Not an ARRAY reference at 
/usr/local/lib/perl5/site_perl/5.6.1/XML/DOM.pm line 959.

Does anyone have an ideas what else I can try to do to fix this / track 
down further details of the problem.

thanks in advance
mike

-- 
MINDsweep
catchpell house
bernard street - carpet lane 
edinburgh - UK - eh6 6sp

m: 07814578523


MINDsweep www.mindsweep.net is a division of c2sky services limited
www.c2sky.net

This e-mail may contain confidential information.  It is intended solely
for the attention of the designated recipient(s).  If you are not the
intended recipient, you must not make any use of the information
contained in the e-mail or cause or allow anyone to do so.  Please
contact the sender immediately and delete the message.

_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved