[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu May 8 15:19:50 UTC 2003


mwilkinson
Thu May  8 11:19:50 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv1191/Perl/MOBY

Modified Files:
	Central.pm 
Log Message:
test that a XML::DOM search returns a node before we take the value of it
moby-live/Perl/MOBY Central.pm,1.24,1.25
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/05/08 15:13:17	1.24
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/05/08 15:19:50	1.25
@@ -1118,7 +1118,8 @@
     } elsif ($simp_coll eq "Simple")  {
 	    
 	    
-	    my $article = $node->getAttributeNode("articleName")->getValue();
+	    my $article = $node->getAttributeNode("articleName");
+		$article = $article->getValue() if $article;
 		# get object type and its URI from the ontoogy server
         my $types =  $node->getElementsByTagName('objectType');
 		my $OE = MOBY::OntologyServer->new(ontology => "object");
@@ -1160,7 +1161,8 @@
 				  $collid));
 				 
     } elsif ($simp_coll eq "Parameter"){
-	    my $article = $node->getAttributeNode("articleName")->getValue();
+	    my $article = $node->getAttributeNode("articleName");
+		$article = $article->getValue() if $article;
         my $types =  $node->getElementsByTagName('datatype');
 	    my $datatype;       
         foreach ($types->item(0)->getChildNodes){ # should only ever be one!
@@ -3085,7 +3087,7 @@
         next unless $_->getNodeType == ELEMENT_NODE;
 		my $attnodes = $_->getAttributes;
 		foreach my $attr(@attrs){
-			$att_value{$attr}= $attnodes->getNamedItem($attr)->getValue;
+			$att_value{$attr}= $attnodes->getNamedItem($attr)?$attnodes->getNamedItem($attr)->getValue:undef;
 		}
         my @child2 = $_->getChildNodes;
         foreach (@child2){




More information about the MOBY-guts mailing list