[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Nov 12 16:47:16 UTC 2003


mwilkinson
Wed Nov 12 11:47:16 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv11847/MOBY

Modified Files:
	CommonSubs.pm 
Log Message:
added a somewhat useful subroutine to common subs that will extract the content of a request as a string

moby-live/Perl/MOBY CommonSubs.pm,1.27,1.28
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/11/08 17:21:31	1.27
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/11/12 16:47:16	1.28
@@ -157,6 +157,7 @@
     getArticles
     getCollectedSimples
     getNodeContentWithArticle
+    extractRawContent
     collectionResponse
     validateNamespaces
     isSimpleArticle
@@ -177,6 +178,7 @@
     getArticles
     getCollectedSimples
     getNodeContentWithArticle
+    extractRawContent
     collectionResponse
     validateNamespaces
     isSimpleArticle
@@ -768,6 +770,31 @@
 =cut
 
 
+=head2 extractRawContent
+
+ name     : extractRawContent
+ function : pass me an article (Simple, or Collection) and I'll give you the
+            content AS A STRING - i.e. the raw XML of the contained MOBY Object(s)
+ usage    : extractRawContent($simple)
+ input    : the one element of the output from getArticles
+ returns  : string
+
+=cut
+
+
+sub extractRawContent {
+    my ($article) = @_;
+    return "" unless $article;
+    return "" unless ref($article) =~ /XML::DOM/;
+    my $response;
+    foreach ($article->getChildNodes){
+        $response .= $_->toString;
+    }
+    return $response;
+    
+}
+
+
 sub getNodeContentWithArticle{
 	# give me a DOM, a TagName, an articleName and I will return you the content
 	# of that node **as a string** (beware if there are additional XML tags in there!)




More information about the MOBY-guts mailing list