[MOBY-dev] Problems using serviceInputParser method when the mobyservice receives multiple Simple inputs

Jose Manuel Rodriguez jmrodriguez at cnio.es
Fri Mar 23 10:46:59 UTC 2007


Hi Eddie,

I have been looking for the reason why sometimes works or not...The 
difference is XML::LibXML library.

Here I am going to show you results from both "getAttributeNode" and  
"getAttributeNodeNS" methods depending on different versions of XML::LibXML:

The input XML is :

<?xml version='1.0' encoding='UTF-8'?>
        <moby:MOBY xmlns:moby='http://www.biomoby.org/moby' 
moby:smessageVersion='0.88'>
              <moby:mobyContent>
                  <moby:mobyData queryID='1'>

<moby:Simple moby:articleName='end'>
        <moby:DateTime moby:namespace="" moby:id="" 
articleName="">20060215121817</moby:DateTime>
</moby:Simple>

<moby:Simple articleName='start'> <!-- NO NAMESPACE -->
        <moby:DateTime moby:namespace="" moby:id="" 
moby:articleName="">20060215121816</moby:DateTime>
</moby:Simple>
<moby:Parameter 
moby:articleName='includeTests'><Value>true</Value></moby:Parameter></moby:mobyData>

              </moby:mobyContent>
        </moby:MOBY>

XML::LibXML version 1.58:

Getting information for inner element 'Simple'
         articleName: 'end'                                           
                # getAttributeNode("articleName") Now MOBY libraries use 
this method WE HAVE RESULT
         articleName NS empty: ''                                       
         # getAttributeNodeNS("", "articleName")
         articleName NS: 'end'                                          
            # getAttributeNodeNS("http://www.biomoby.org/moby", 
"articleName")
Getting information for inner element 'Simple'
         articleName: 'start'
         articleName NS empty: ''
         articleName NS: ''

The same script using XML::LibXML version 1.62:

Getting information for inner element 'Simple'
         articleName: ''                                                
                    # DIFFERENT RESULT!!!!!!!!!
         articleName NS empty: ''
         articleName NS: 'end'
Getting information for inner element 'Simple'
         articleName: 'start'
         articleName NS empty: 'start'
         articleName NS: ''


So, we see different results depending on XML::LibXML version but 
thinking which is the correct one because maybe the problem is on LibXML 
libraries not on MOBY. I have run the same methods with Java libraries 
whose results are:

java version "1.5.0_08":

Getting information for inner element 'Simple'
         articleName: ''
         articleName NS empty: ''
         articleName NS: 'end'
Getting information for inner element 'Simple'
         articleName: 'start'
         articleName NS empty: 'start'
         articleName NS: ''


The same results than version 1.62.


In any case, in my opinion we have to control the XML libraries using 
better methods as (getAttributeNodeNS("http://www.biomoby.org/moby", 
"articleName")).

Other question I have is we are obligate to add namespaces within MOBY 
xml's or not. The MOBY standard says something about that...

Best Regards,
José.


SP: If you want I can send you the scripts :)









Edward Kawas wrote:
> 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
>>     
>
>
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/moby-dev
>
>   


-- 
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.




More information about the MOBY-dev mailing list