[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Wed Dec 15 04:13:47 UTC 2004


kawas
Tue Dec 14 23:13:47 EST 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv13883/MOBY/Client

Modified Files:
	Central.pm 
Log Message:
checked for CDATA and tried to excise it - eddie

moby-live/Perl/MOBY/Client Central.pm,1.85,1.86
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/12/14 22:31:30	1.85
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/12/15 04:13:47	1.86
@@ -3,7 +3,6 @@
 use SOAP::Lite;
 
 #use SOAP::Lite + trace;  # for debugging
-
 use strict;
 use Carp;
 use XML::LibXML;
@@ -377,7 +376,7 @@
 	$term ||= "";
 	my $desc = $a{'description'};
 	$desc ||= "";
-	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	my $contactEmail = $a{'contactEmail'};
@@ -507,15 +506,17 @@
 	my $Object      = $doc->getDocumentElement();
 	my $obj         = $Object->nodeName;
 	return undef unless ( $obj eq 'retrieveObjectDefinition' );
-	my $term    = &_nodeTextContent( $Object, "objectType" );
-	my $desc    = &_nodeCDATAContent( $Object, "Description" );
+	my $term = &_nodeTextContent( $Object,  "objectType" );
+	my $desc = &_nodeCDATAContent( $Object, "Description" );
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
+		$desc = $1;
+	}
 	my $authURI = &_nodeTextContent( $Object, "authURI" );
 	my $email   = &_nodeTextContent( $Object, "contactEmail" );
 	my %att_value;
 	my %relationships;
 	my $x                = $doc->getElementsByTagName( "Relationship" );
 	my $no_relationships = $x->size();
-
 	for ( my $n = 1 ; $n <= $no_relationships ; ++$n ) { #get_node starts at one
 		my $relationshipType =
 		  $x->get_node( $n )->getAttributeNode( 'relationshipType' )
@@ -569,7 +570,7 @@
 	my $type = $a{'serviceType'};
 	$type ||= "";
 	my $desc = $a{'description'};
-	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	$desc ||= "";
@@ -652,7 +653,7 @@
 	my $authURI = $a{'authURI'};
 	$authURI ||= "";
 	my $desc = $a{'description'};
-	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	$desc ||= "";
@@ -768,7 +769,8 @@
 	$URL ||= "";
 	my $desc = $a{description};
 	$desc ||= "";
-	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+
+	if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 		$desc = $1;
 	}
 	my $signatureURL = $a{signatureURL};
@@ -847,7 +849,7 @@
 						$message .= "<Simple articleName='$articleName'>\n";
 					}
 					my ( $type, $Namespaces ) = @{$objectdef};
-					$type ||="";
+					$type ||= "";
 					$message .= "<objectType>$type</objectType>\n";
 					unless ( ref( $Namespaces ) =~ /array/i ) {
 						return $self->errorRegXML(
@@ -1209,18 +1211,16 @@
 	my @child = $de->childNodes;
 	my $content;
 	foreach ( @child ) {
-		$debug && &_LOG( getNodeTypeName($_), "\t", $_->toString, "\n" );
+		$debug && &_LOG( getNodeTypeName( $_ ), "\t", $_->toString, "\n" );
 		if ( $_->nodeType == TEXT_NODE ) {
-				if ($_->nodeValue=~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
-					$content .= $1;
-				} else {
-				$content .= $_->nodeValue;    #else try $_->textContent
-				}
+			$content .= $_->nodeValue;    #else try $_->textContent
 		} else {
 			$content .= $_->toString;
 		}
 	}
 	$content =~ s/^\n//gs;
+	$content =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
+
 	return $content;
 }
 
@@ -1323,10 +1323,11 @@
 				 $types->get_node( $x )->getElementsByTagName( 'Description' ) )
 		{
 			$desc = $elem->firstChild->toString;
-			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+			if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 				$desc = $1;
 			}
 		}
+		$desc =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
 		$servicetypes{$type} = $desc;
 	}
 	return \%servicetypes;
@@ -1365,10 +1366,11 @@
 			   $obnames->get_node( $x )->getElementsByTagName( 'Description' ) )
 		{
 			$desc = $elem->firstChild->toString;
-			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+			if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 				$desc = $1;
 			}
 		}
+		$desc =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
 		$objectnames{$name} = $desc;
 	}
 	return \%objectnames;
@@ -1407,10 +1409,11 @@
 		{
 			$desc = $elem->firstChild;
 			$desc = $desc ? $desc->toString : "";
-			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+			if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 				$desc = $1;
 			}
 		}
+		$desc =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
 		$namespaces{$ns} = $desc;
 	}
 	return \%namespaces;
@@ -1456,10 +1459,11 @@
 					$objects->get_node( $x )->getElementsByTagName( 'Schema' ) )
 		{
 			$desc = $elem->firstChild->nodeValue;
-			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+			if ( $desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/ ) {
 				$desc = $1;
 			}
 		}
+		$desc =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
 		$objects{$name} = $desc;
 	}
 	return \%objects;
@@ -1659,7 +1663,8 @@
 
 		#my $Output = &_nodeTextContent($Service, 'outputObject');
 		my $Description = &_nodeCDATAContent( $Service, 'Description' );
-		my $cat         = &_nodeTextContent( $Service, 'Category' );
+		$Description =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
+		my $cat         = &_nodeTextContent( $Service,  'Category' );
 		my @INPUTS;
 		my @OUTPUTS;
 		foreach my $inout ( "Input", "Output" ) {
@@ -1821,10 +1826,10 @@
 	my $Object = $doc->getDocumentElement();
 	my $obj    = $Object->nodeName;
 	return undef unless ( $obj eq 'MOBYRegistration' );
-	my $id      = &_nodeTextContent( $Object, 'id' );
-	my $success = &_nodeTextContent( $Object, 'success' );
+	my $id      = &_nodeTextContent( $Object,  'id' );
+	my $success = &_nodeTextContent( $Object,  'success' );
 	my $message = &_nodeCDATAContent( $Object, 'message' );
-	my $RDF     = &_nodeRawContent( $Object,  'RDF' );
+	my $RDF     = &_nodeRawContent( $Object,   'RDF' );
 	my $reg = MOBY::Client::Registration->new(
 											   success         => $success,
 											   message         => $message,
@@ -1844,7 +1849,9 @@
 	);
 	return $reg;
 }
+
 sub _nodeCDATAContent {
+
 	# will get text of **all** child $node from the given $DOM
 	# regardless of their depth!!
 	my ( $DOM, $node ) = @_;
@@ -1853,16 +1860,15 @@
 	my @child = $x->get_node( 1 )->childNodes;
 	my $content;
 	foreach ( @child ) {
+
 		#print getNodeTypeName($_), "\t", $_->toString,"\n";
 		next unless $_->nodeType == TEXT_NODE;
 		$content = $_->toString;
-		if ($content =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
-			$content = $1;
-			return $content;
-		}
 	}
+	$content =~ s/<!\[CDATA\[((?>[^\]]+))\]\]>/$1/gs;
 	return $content;
 }
+
 sub _nodeTextContent {
 
 	# will get text of **all** child $node from the given $DOM
@@ -1873,6 +1879,7 @@
 	my @child = $x->get_node( 1 )->childNodes;
 	my $content;
 	foreach ( @child ) {
+
 		#print getNodeTypeName($_), "\t", $_->toString,"\n";
 		next unless $_->nodeType == TEXT_NODE;
 		$content = $_->toString;




More information about the MOBY-guts mailing list