[xml] LibXML and Perl



I have included a sample of a script that is very simple.

It opens a file with valid XML and loads it into a variable

Enters a while loop.

The while loop allows you to specifie the number of iterations on the
command line. So for the number
of times you request it will....


Create a new XML::LibXML object
and calls the parser_string method on the XML

Then undefine any variable that it once used.


When I run this script it will consume an additional 10 megs per second
of memory. Is there anyone who could tell me why.


#!/usr/bin/perl

use XML::LibXML;
use XML::LibXSLT;
open(XSL, "/root/xml/xsl/crt_order-in.xsl") or die "No XSL\n";
open(XML, "/root/xml/xml/crt_order.xml") or die "No XML\n";
my $xsl = join("", <XSL>);
my $xml = join('', <XML>);
close XSL;
close XML;

XML::LibXML->validation(1);
XML::LibXML->load_ext_dtd(1);
XML::LibXML->keep_blanks(0);

XML::LibXML->read_callback(\&readme) ;
XML::LibXML->match_callback(\&matchme);
XML::LibXML->open_callback(\&openme);
XML::LibXML->close_callback(\&closeme);

$a = 0;
while ($a < $ARGV[0]) {
        ++$a;
        my $parser = XML::LibXML->new();
        my $xslt = XML::LibXSLT->new();
        my $source = $parser->parse_string($xml);
        $u = 0;
        $source = undef;
        $dtdobj = undef;
        $style_doc = undef;
        $stylesheet = undef;
        $results = undef;
        $parent = undef;
        $tr_base = undef;
        $tr_basename = undef;
        $parser = undef;
        undef @string;
}




Also when I use the getSomethingByName methods (getAttributeByName, and
getElementsByName)
they are case sensitive. I thought they we supposed to be case
insensative.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]