[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Sep 30 23:23:13 UTC 2005


mwilkinson
Fri Sep 30 19:23:13 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv8253/MOBY

Modified Files:
	CommonSubs.pm 
Log Message:
the behaviour of getNodeContentsWithArticle were not as advertised in the documentation.  They should be now.  Text content of the outermost MOBY object node can be extracted if you pass it either the that node, or the Simple article containing that node.

moby-live/Perl/MOBY CommonSubs.pm,1.69,1.70
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2005/09/21 19:05:14	1.69
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2005/09/30 23:23:13	1.70
@@ -972,6 +972,13 @@
   my @contents;
   return () unless ( (ref( $node ) =~ /XML\:\:LibXML/) &&  $element);
 
+
+  my $nodes = $node->getElementsByTagName( $element );
+  unless ( $nodes->get_node( 1 ) ) {
+    $nodes = $node->getElementsByTagName("moby:$element");
+  }
+  $node = $nodes->get_node(1);  # this routine should only ever be called if there is only one possible answer, so this is safe
+  
   unless ($articleName){  # the request is for root node if no articleName
     my $resp;
     foreach my $child($node->childNodes){
@@ -983,11 +990,6 @@
     return @contents;
   }
 
-  my $nodes = $node->getElementsByTagName( $element );
-  unless ( $nodes->get_node( 1 ) ) {
-    $nodes = $node->getElementsByTagName("moby:$element");
-  }
-
   # if there is an articleName, then get that specific node
   for ( 1 .. $nodes->size() ) {
     my $child = $nodes->get_node( $_ );




More information about the MOBY-guts mailing list