When I used the google geo service i met "Required item type of first operand of '/' is node(); supplied value has item type xs:string" problem

61 views
Skip to first unread message

ShiYU Gao

unread,
Dec 8, 2010, 4:36:24 AM12/8/10
to Open Mashup Alliance Interest Group
HI:

I'm a new user of the emml. When I use the <driectinvoke> to invoke
the google's geo service and use the XPath expression to do the
mashup, met an error like this

<error>
<errorMessage>1002</errorMessage>
<errorMessage><![CDATA[Required item type of first operand of '/' is
node(); supplied value has item type xs:string]]> </errorMessage>
</error>

and my emml is :

<directinvoke endpoint="http://maps.google.com/maps/api/geocode/xml"
latlng="$lanlon"
sensor="false"
outputvariable="$address" />
<display expr="$address//formatted_address"></display>
<appendresult outputvariable="$result">
<result>
<address>{$address//GeocodeResponse/result/formatted_address}
</address>
</result>
</appendresult>


please help me.
BRS

Raj

unread,
Dec 9, 2010, 8:49:25 AM12/9/10
to open-mashu...@googlegroups.com
Hi,

Can you check what the response from google geocoding service is i.e.,

<display message="Google geocoding response = "  expr="$address"/>

It is probably returning a error response message.


Typically, you get that error message  when trying to dereference a string value in a variable as XML document.

thanks,
raj



ShiYU Gao

unread,
Dec 9, 2010, 9:51:04 PM12/9/10
to open-mashu...@googlegroups.com
Hi,

I have printed the result of the google geocoding response. It is like this:

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>street_address</type>
  <formatted_address>279-281 Bedford Ave, Brooklyn, NY 11211, USA</formatted_address>
  <address_component>
   <long_name>279-281</long_name>
   <short_name>279-281</short_name>
   <type>street_number</type>
  </address_component>
.....................
......................

 </result>
</GeocodeResponse>

It is a qualified xml response. But in the XPath it still product the error message.

thanks,
ShiYU Gao

Raj

unread,
Dec 10, 2010, 12:48:24 AM12/10/10
to open-mashu...@googlegroups.com
1. Can u send the server stack trace associated with this error.  (from your appserver console or log file)


2. I tried to re-produce this issue, but am able to execute the following equivalent EMML successfully:

        <output name="result" type="document"/>

        <variable name="latlng" type="string" default="40.714224,-73.961452"/>

        <directinvoke endpoint="http://maps.googleapis.com/maps/api/geocode/xml"
                       latlng="$latlng"
                        sensor="false"
                        outputvariable="$address" />                 
        <display expr="$address//formatted_address"></display>       

        <appendresult outputvariable="$result">
            <result>
             <address>{$address//GeocodeResponse/result/formatted_address}
             </address>
            </result>
        </appendresult>


The output :
<?xml version="1.0" encoding="UTF-8"?>
<xml>
   <result>
      <address>
         <formatted_address>279-281 Bedford Ave, Brooklyn, NY 11211, USA</formatted_address>
         <formatted_address>Williamsburg, New York, USA</formatted_address>
         <formatted_address>New York, NY 11211, USA</formatted_address>
         <formatted_address>Brooklyn, NY, USA</formatted_address>
         <formatted_address>Kings, New York, USA</formatted_address>
         <formatted_address>New York, NY, USA</formatted_address>
         <formatted_address>New York, USA</formatted_address>
         <formatted_address>United States</formatted_address>
      </address>
   </result>
</xml>

ShiYU Gao

unread,
Dec 10, 2010, 1:10:41 AM12/10/10
to open-mashu...@googlegroups.com
Hi,
Thank you very much. My code is working now. Thanks again.

thanks,
ShiYU Gao

2010/12/10 Raj <rajmohan.kr...@jackbe.com>

Alejandro Escalante Medina

unread,
Dec 10, 2010, 9:44:16 PM12/10/10
to open-mashu...@googlegroups.com
Please, someone, unsubscribe me from this list. I've tried to several times without luck...
Reply all
Reply to author
Forward
0 new messages