[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Sat Jul 12 18:33:37 UTC 2003


mwilkinson
Sat Jul 12 14:33:37 EDT 2003
Update of /home/repository/moby/moby-live/Perl/scripts
In directory pub.open-bio.org:/tmp/cvs-serv17957/Perl/scripts

Modified Files:
	MOBY-Client05.cgi 
Log Message:
fixing the client

moby-live/Perl/scripts MOBY-Client05.cgi,1.12,1.13
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/07/12 06:53:07	1.12
+++ /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/07/12 18:33:37	1.13
@@ -186,12 +186,16 @@
         my $doc = $Parser->parse($_);
         my $Object = $doc->getDocumentElement();
         my $obj = $Object->getTagName;
-        my $ns = $Object->getAttributeNode("namespace")->getValue();
-        my $id = $Object->getAttributeNode("id")->getValue();
+        my $ns = $Object->getAttributeNode("namespace");
+        next unless $ns;
+        $ns = $ns->getValue();
+        my $id = $Object->getAttributeNode("id");
+        next unless $id;
+        $id = $id->getValue();
         my $name = $Object->getAttributeNode("articleName");
         $name &&=($name->getValue());
         $name ||="";
-        _LOG("writeCurrentObjects: $name Object was $obj namespace was $ns\n");
+        _LOG("writeCurrentObjects: $name Object was $obj namespace was $ns id was $id\n");
         $obj = escapeHTML($obj);	# escape the name, namespace, and object XML
         $ns = escapeHTML($ns);
         $id = escapeHTML($id);
@@ -210,11 +214,10 @@
         if ($CRIB->item(0)){
             $XrefString .="<b>Cross References:</b> ";
             my @XrefsXML;
-            my $Xref_list = $CRIB->item(0)->getChildNodes();
-            foreach (0..$Xref_list->getLength-1){
-                next unless $Xref_list->item($_)->getNodeType == ELEMENT_NODE;
-                my $ns = $Xref_list->item($_)->getAttributeNode("namespace")->getValue();
-                my $id = $Xref_list->item($_)->getAttributeNode("id")->getValue();
+            foreach my $child ($CRIB->item(0)->getChildNodes()){
+                next unless $child->getNodeType == ELEMENT_NODE;
+                my $ns = $child->getAttributeNode("namespace")->getValue();
+                my $id = $child->getAttributeNode("id")->getValue();
                 if (($ENV{HTTP_HOST} =~ /localhost/) || ($ENV{HTTP_HOST} =~ /192\.168\.1\./)){               
                     $XrefString .= "<a href='http://localhost/cgi-bin/MOBY-Client.cgi?namespace=$ns;id=$id;reinitialize=1' target ='new'>$ns : $id</a>,&nbsp;&nbsp;&nbsp;&nbsp;"; 
                 } else {
@@ -225,11 +228,15 @@
         }
         
         my $OBJ = "";
-        $OBJ .= "<b>NameSpace: </b>$ns<br><b>ID:$id</b><br>";
+        $OBJ .= "<b>NameSpace: </b>$ns<br>
+                 <b>ID:$id</b><br>";
         
         foreach ($Object->getChildNodes()){
             my $data;
-            if ($_->getNodeType == TEXT_NODE || $_->getNodeType == CDATA_SECTION_NODE){
+            if (($_->getNodeType == TEXT_NODE) || ($_->getNodeType == CDATA_SECTION_NODE)){
+                $data = $_->toString;
+                chomp $data;
+                next unless $data;
                 $data = "<pre>".($_->toString)."</pre>";
             } elsif ($_->getNodeType == ELEMENT_NODE){
                 next if  ($_->getTagName =~ /CrossReference/);
@@ -240,6 +247,9 @@
                     $article = "";
                 }
                 $OBJ .= "<b>$article (".escapeHTML($_->getTagName).")</b> : ";
+                foreach my $content($_->getChildNodes){
+                    $data .= $content->toString if (($content->getNodeTypeName == TEXT_NODE) || ($_->getNodeType == CDATA_SECTION_NODE));
+                }
             }
 #                $OBJ .= "".escapeHTML($Payload->item($_)->toString)."<br>";
             $OBJ .= "$data<br>";




More information about the MOBY-guts mailing list