[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Sep 12 15:34:21 EDT 2003


mwilkinson
Fri Sep 12 14:34:21 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv28369

Modified Files:
	CollectionArticle.pm 
Log Message:
wasn't creating collections properly.  I need them for the USDA client program

moby-live/Perl/MOBY/Client CollectionArticle.pm,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm	2003/07/04 14:43:09	1.4
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm	2003/09/12 18:34:21	1.5
@@ -77,7 +77,7 @@
                  get both Simple and Collection objects in your
                  Input and output lists, it is good to be able
                  to test what you have in-hand)
- Returns   :	1 (true)
+ Returns   :	0 (false)
 
 =cut
 
@@ -91,7 +91,7 @@
                  get both Simple and Collection objects in your
                  Input and output lists, it is good to be able
                  to test what you have in-hand)
- Returns   :	0 for false
+ Returns   :	1 (true)
 
 =cut
 
@@ -137,7 +137,7 @@
     sub addSimple {
         my ($self, $s) = @_;
         return $self->{Simples} unless $s;
-        return 0 unless $s->isa("MOBY::Client::SimpleArtcle");
+        return 0 unless $s->isa("MOBY::Client::SimpleArticle");
         push @{$self->{Simples}}, $s;
         return $self->{Simples};
     }
@@ -190,7 +190,6 @@
 sub createFromDOM {
     my ($self, $dom) = @_;
     return 0 unless ($dom && ($dom->getTagName eq "Collection"));
-
     $self->articleName("");
     $self->Simples([]);
     
@@ -199,9 +198,11 @@
     $articleName = $attr->getValue if $attr;
     $self->articleName($articleName);
     my $objects = $dom->getElementsByTagName("Simple");
-    foreach my $child($objects->item(0)->getChildNodes){  # there must be only one in a simple!  so take element 0
-        next unless $child->getNodeType == ELEMENT_NODE;
-        $self->addSimple(MOBY::Client::SimpleArticle->new(XML_DOM => $child));
+    for my $n(0..$objects->getLength - 1){
+        foreach my $child($objects->item($n)->getChildNodes){
+            next unless $child->getNodeType == ELEMENT_NODE;
+            $self->addSimple(MOBY::Client::SimpleArticle->new(XML_DOM => $objects->item($n)));
+        }
     }
     return $self;
 }



More information about the MOBY-guts mailing list