[MOBY-dev] Problems using serviceInputParser method when the mobyservice receives multiple Simple inputs
Edward Kawas
edward.kawas at gmail.com
Thu Mar 22 16:41:35 UTC 2007
The code that I used to test getting any attribute regardless of the prefix
is the below. Notice that id is prefixed while namespace is not ...
---------------------
use XML::LibXML;
my $xml =<<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<moby:MOBY xmlns:moby="http://www.biomoby.org/moby">
<moby:mobyContent>
<moby:mobyData moby:queryID="sip_1_">
<moby:Simple moby:articleName="gene">
<moby:Object moby:id="7422" namespace="EntrezGene_EntrezGeneID" />
</moby:Simple>
</moby:mobyData>
</moby:mobyContent>
</moby:MOBY>
EOF
my $p = XML::LibXML->new;
my $doc = $p->parse_string( $xml );
my $root = $doc->getDocumentElement;
$root = $root->getElementsByLocalName('Object')->item(0);
print "The XML:\n$xml\n";
print "Getting information for inner element 'Object'\n";
print "\tnamespace: '" .$root->getAttributeNS("", "namespace") . "'\n";
print "\tid: '" .$root->getAttributeNS("", "id") . "'\n";
----------------------------------
Eddie
> -----Original Message-----
> From: moby-dev-bounces at lists.open-bio.org [mailto:moby-dev-
> bounces at lists.open-bio.org] On Behalf Of Jose Manuel Rodriguez
> Sent: Thursday, March 22, 2007 2:32 AM
> To: Core developer announcements
> Subject: [MOBY-dev] Problems using serviceInputParser method when the
> mobyservice receives multiple Simple inputs
>
> Hi everyone,
>
> I am executing a MOBY services in Perl which needs multiple Simple inputs.
> To extract the MOBY messages, when the service are called, I am using
> the "serviceInputParser" but I have seen that the returned hashref which
> contains the Simple inputs is wrong. I mean, the hashref
>
> ,whose structure is "$inputs->{$queryID}->{articleName}",
>
> has always empty articleName value. That means the articleName of Simple
> Object is not obtained correctly. (if we have multiple simple inputs in
> one mobyData, the hashref returned by "serviceInputParser" will contain
> the last MOBY Object).
>
>
>
> I have been checking the code and I have seen in the method
> "createFromDOM" from "MOBY::Client::SimpleArticle" file that the
> 'articleNames' attribute is not extracted when this belongs to the
> namespace of "moby".
>
>
> my $attr = $dom->getAttributeNode( 'articleName' );
> my $articleName = $attr ? $attr->getValue : "";
>
>
> Here you are one solution in this particular problem:
>
> my $attr = $dom->getAttributeNodeNS( 'http://www.biomoby.org/moby',
> 'articleName' );
> $attr = $dom->getAttributeNode( 'articleName' ) unless defined $attr;
> my $articleName = $attr ? $attr->getValue : "";
>
>
>
> (but I think this is one of more problems regarding MOBY namespaces)
>
> Best Regards,
> José.
>
> --
> José Manuel Rodríguez Carrasco e-mail: jmrodriguez at cnio.es
> Tlfn: (+34) 91 732 80 00 ext: 2256 Fax: (+34) 91 224 69 76
> Bioinformatic Unit
> Spanish National Cancer Center (CNIO) http://www.cnio.es
> Zip Code: 28029
> Adress: C/. Melchor Fernandez Almagro nº 3, Madrid (Spain)
>
>
> **NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en su caso los
> ficheros adjuntos, pueden contener información protegida para el uso
> exclusivo de su destinatario. Se prohíbe la distribución, reproducción o
> cualquier otro tipo de transmisión por parte de otra persona que no sea el
> destinatario. Si usted recibe por error este correo, se ruega comunicarlo
> al remitente y borrar el mensaje recibido.
> **CONFIDENTIALITY NOTICE** This email communication and any attachments
> may contain confidential and privileged information for the sole use of
> the designated recipient named above. Distribution, reproduction or any
> other use of this transmission by any party other than the intended
> recipient is prohibited. If you are not the intended recipient please
> contact the sender and delete all copies.
>
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/moby-dev
More information about the MOBY-dev
mailing list