Hi!
This programm gives out a parsed xmlpage + a unparsed xmlpage..
how can i use the parsed data which i print out with print
processNode($accessions->item($i));
into my sub get_idlist?

use LWP::Simple;
  use XML::DOM;
  use CGI;
  my $cgi = new CGI;
  use CGI::Carp qw(fatalsToBrowser);


  my $eingabe=$cgi->param("Suchtext");
  my $Autor = "Eva Horn";
  $cgi->default_dtd('-//W3C//DTD HTML 4.01 Transitional//EN');

  print $cgi->header(),
 $cgi->i($Autor),
   $cgi->start_html(-BGCOLOR=>'white'),
 $cgi->h1('Ergebnis'),
        $cgi->h3($eingabe),


 $cgi->end_html();



sub daten_einlesen()

 {
 my $url='http://www.fcgi?db=';
 my $datenbank=$_[0];
 my $a ='&term=';
 my $xx='&field=title&retmax=2';
  return $url.$datenbank.$a.$eingabe.$xx;
 }
sub get_idlist
{
 my $url1='http://www.fcgi?db=';
 my $datenbank2=$_[0];



 my $a1 ='&id=';how do i give the content of the returnvalue [return
($accessions->item($i));] to my $a1?so that i don t give it out,but take
it as new value for my 'my $a1'



 my $xx1='&retmode=xml';
  return $url1.$datenbank2.$a1.$xx1;
}


# The MAIN-PROGRAM

sub starte_prog {

  my $doc;
  my $datenverarbeiten;
  $datenverarbeiten=&daten_einlesen("nucleotide");
  my $doc =get$datenverarbeiten;
  processXML($doc);
  print "Nucleotide\n";
  my $doc1;
  my $datenverarbeiten_id;
  $datenverarbeiten_id=&get_idlist("nucleotide");
  my $doc1=get$datenverarbeiten_id;
  print $doc1;
  print "\n";
}
sub processXML
{
my $xmldoc = $_[0];
my $parser = new XML::DOM::Parser;
my $doc = $parser->parse($xmldoc);
my $nodes = $doc->getElementsByTagName("Result");
for (my $i=0; $i<$nodes->getLength(); $i++)
 {
 my $node = $nodes->item($i);
 my $accessions=$node->getElementsByTagName("Id");
 print processNode($accessions->item($i));
 # return ($accessions->item($i));
 print "\t";
 }
 $doc->dispose;
}
sub processNode
{
 my $nodes = $_[0]->getChildNodes();
 my $text;
 for (my $i=0; $i<$nodes->getLength();$i++ )
{
    my $node = $nodes->item($i);
     if ($node->getNodeType() ==XML::DOM::Node::ELEMENT_NODE())
     {
     $text .= $node->getFirstChild()->getNodeValue()
  }
   else
    {
      $text .= $node->getNodeValue()
     }
 }
 return $text;
}
#hauptprogramm
starte_prog();







-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to