on 2017 Dec 15 4:01 AM
Hello!
When using "openxml" on results of the Google Geocoding API, I receive an XML parser error with the message "Invalid control character" for certain address details. Here's an example:
select * from openxml("CallGoogleapi"('https://maps.googleapis.com/maps/api/geocode/xml?address=pasica+75000+tuzla&language=en'),'/GeocodeR... with("lat" long varchar 'text()')
with "CallGoogleapi" defined as
FUNCTION "CallGoogleapi"( in "sLocation" long varchar ) returns xml url '!sLocation!' type 'HTTP:GET'
What can I do, so that openxml does not geerate this error?
Thanks in advance!
Dirk
Request clarification before answering.
I forgot to mention that this call normally works. For "berlin" I can calculate lat/log without oproblems:
"https://maps.googleapis.com/maps/api/geocode/xml?address=berlin&language=en" "......<lat>52.5200066</lat><lng>13.4049540</lng>....."
In the query "pasica+75000+tuzla" sa-17 reports the parsing error at character 150, line 6, column 41:
1 < ?xml version="1.0" encoding="UTF-8"?>
2 -< GeocodeResponse>
3 < status>OK< /status>
4 < result>
5 < type>route< /type>
6 < formatted_address>Hadži Hasanage Pašića, Tuzla 75000, Bosnia and Herzegovina< /formatted_address>
7 < address_component>
8 < long_name>Hadži Hasanage Pašića< /long_name>
.....
Saving the result to a file, I see the following result with an unicode character:
<formatted_address>Hadži Hasanage Paši**/u001a**a, Tuzla 75000, Bosnia and Herzegovina</formatted_address>
In line 6, column 41 there is a hex "1A00" or U+001A. Apparently, openxml has a problem with this character. Would I have to do a conversion here?
Kind regards, Dirk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sufficiently expert in XML to decide whether this is correct but my guess is that 'encoding="UTF-8"' makes it valid. Unless your database's char collation is UTF-8, it might be worth trying to use nvarchar instead of varchar in your definitions.
At least, this information could help to locate the problem.
Cheers
Volker
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.