[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Tue Dec 14 18:58:20 UTC 2004


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

Modified Files:
	Central.pm OntologyServer.pm Registration.pm Service.pm 
Log Message:
hopefully fixed the cdata bug - eddie

moby-live/Perl/MOBY/Client Central.pm,1.81,1.82 OntologyServer.pm,1.7,1.8 Registration.pm,1.7,1.8 Service.pm,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/11/18 17:41:15	1.81
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/12/14 18:58:20	1.82
@@ -3,6 +3,7 @@
 use SOAP::Lite;
 
 #use SOAP::Lite + trace;  # for debugging
+
 use strict;
 use Carp;
 use XML::LibXML;
@@ -376,6 +377,9 @@
 	$term ||= "";
 	my $desc = $a{'description'};
 	$desc ||= "";
+	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+		$desc = $1;
+	}
 	my $contactEmail = $a{'contactEmail'};
 	$contactEmail ||= "";
 	my $authURI = $a{'authURI'};
@@ -504,7 +508,7 @@
 	my $obj         = $Object->nodeName;
 	return undef unless ( $obj eq 'retrieveObjectDefinition' );
 	my $term    = &_nodeTextContent( $Object, "objectType" );
-	my $desc    = &_nodeTextContent( $Object, "Description" );
+	my $desc    = &_nodeCDATAContent( $Object, "Description" );
 	my $authURI = &_nodeTextContent( $Object, "authURI" );
 	my $email   = &_nodeTextContent( $Object, "contactEmail" );
 	my %att_value;
@@ -565,6 +569,9 @@
 	my $type = $a{'serviceType'};
 	$type ||= "";
 	my $desc = $a{'description'};
+	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+		$desc = $1;
+	}
 	$desc ||= "";
 	my $email = $a{'contactEmail'};
 	$email ||= "";
@@ -645,6 +652,9 @@
 	my $authURI = $a{'authURI'};
 	$authURI ||= "";
 	my $desc = $a{'description'};
+	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+		$desc = $1;
+	}
 	$desc ||= "";
 	my $contact = $a{'contactEmail'};
 	$contact ||= "";
@@ -758,6 +768,9 @@
 	$URL ||= "";
 	my $desc = $a{description};
 	$desc ||= "";
+	if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+		$desc = $1;
+	}
 	my $signatureURL = $a{signatureURL};
 	$signatureURL ||= "";
 	my $Category = lc( $a{category} );
@@ -1197,7 +1210,11 @@
 	foreach ( @child ) {
 		$debug && &_LOG( getNodeTypeName($_), "\t", $_->toString, "\n" );
 		if ( $_->nodeType == TEXT_NODE ) {
-			$content .= $_->nodeValue;    #else try $_->textContent
+				if ($_->nodeValue=~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+					$content .= $1;
+				} else {
+				$content .= $_->nodeValue;    #else try $_->textContent
+				}
 		} else {
 			$content .= $_->toString;
 		}
@@ -1305,6 +1322,9 @@
 				 $types->get_node( $x )->getElementsByTagName( 'Description' ) )
 		{
 			$desc = $elem->firstChild->toString;
+			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+				$desc = $1;
+			}
 		}
 		$servicetypes{$type} = $desc;
 	}
@@ -1344,6 +1364,9 @@
 			   $obnames->get_node( $x )->getElementsByTagName( 'Description' ) )
 		{
 			$desc = $elem->firstChild->toString;
+			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+				$desc = $1;
+			}
 		}
 		$objectnames{$name} = $desc;
 	}
@@ -1383,6 +1406,9 @@
 		{
 			$desc = $elem->firstChild;
 			$desc = $desc ? $desc->toString : "";
+			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+				$desc = $1;
+			}
 		}
 		$namespaces{$ns} = $desc;
 	}
@@ -1429,6 +1455,9 @@
 					$objects->get_node( $x )->getElementsByTagName( 'Schema' ) )
 		{
 			$desc = $elem->firstChild->nodeValue;
+			if ($desc =~ /<!\[CDATA\[((?>[^\]]+))\]\]>/) {
+				$desc = $1;
+			}
 		}
 		$objects{$name} = $desc;
 	}
@@ -1628,7 +1657,7 @@
 		my $URL           = &_nodeTextContent( $Service, 'URL' );
 
 		#my $Output = &_nodeTextContent($Service, 'outputObject');
-		my $Description = &_nodeTextContent( $Service, 'Description' );
+		my $Description = &_nodeCDATAContent( $Service, 'Description' );
 		my $cat         = &_nodeTextContent( $Service, 'Category' );
 		my @INPUTS;
 		my @OUTPUTS;
@@ -1793,7 +1822,7 @@
 	return undef unless ( $obj eq 'MOBYRegistration' );
 	my $id      = &_nodeTextContent( $Object, 'id' );
 	my $success = &_nodeTextContent( $Object, 'success' );
-	my $message = &_nodeTextContent( $Object, 'message' );
+	my $message = &_nodeCDATAContent( $Object, 'message' );
 	my $RDF     = &_nodeRawContent( $Object,  'RDF' );
 	my $reg = MOBY::Client::Registration->new(
 											   success         => $success,
@@ -1814,7 +1843,25 @@
 	);
 	return $reg;
 }
-
+sub _nodeCDATAContent {
+	# will get text of **all** child $node from the given $DOM
+	# regardless of their depth!!
+	my ( $DOM, $node ) = @_;
+	my $x = $DOM->getElementsByTagName( $node );
+	unless ( $x->get_node( 1 ) ) { return }
+	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;
+		}
+	}
+	return $content;
+}
 sub _nodeTextContent {
 
 	# will get text of **all** child $node from the given $DOM
@@ -1825,7 +1872,6 @@
 	my @child = $x->get_node( 1 )->childNodes;
 	my $content;
 	foreach ( @child ) {
-
 		#print getNodeTypeName($_), "\t", $_->toString,"\n";
 		next unless $_->nodeType == TEXT_NODE;
 		$content = $_->toString;

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/OntologyServer.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Registration.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14




More information about the MOBY-guts mailing list