I am using google contacts API v2 for creating contacts to the google
account.
I am generating xml from contacts properties as below.


<?xml version='1.0' encoding='UTF-8'?><atom:feed xmlns:atom='http://
www.w3.org/2005/Atom'
                xmlns:gContact='http://schemas.google.com/contact/2008'
                xmlns:gd='http://schemas.google.com/g/2005'
                xmlns:batch='http://schemas.google.com/gdata/batch'>
                <atom:category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact' />
                <atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'     xmlns:gContact='http://
schemas.google.com/contact/2008'><batch:id>0</
batch:id><batch:operation type='insert' /><atom:category
scheme='http://schemas.google.com/g/2005#kind' term='http://
schemas.google.com/contact/2008#contact'/
><gContact:groupMembershipInfo deleted='false' href='http://
www.google.com/m8/feeds/groups/[email protected]/base/6'/><atom:title
type='text'><![CDATA[Amy Gilkison]]></atom:title><gd:organization
rel='http://schemas.google.com/g/2005#work'><gd:orgName><!
[CDATA[Verizon Communications]]></gd:orgName></
gd:organization><gd:phoneNumber rel='http://schemas.google.com/g/
2005#work'><![CDATA[(972) 717-8763]]></
gd:phoneNumber><gd:postalAddress rel='http://schemas.google.com/g/
2005#work'><![CDATA[5221 North O'Connor RoadHQL14A37,
 Irving TX 75039]]></gd:postalAddress><atom:content type='text'><!
[CDATA[]]></atom:content><gd:extendedProperty name='address0' value='a:
3:{s:10:"serviceTag";s:4:"work";s:10:"serAddress";s:174:"a:6:{s:
6:"street";s:33:"5221 North O'Connor RoadHQL14A37,";s:5:"state";s:
2:"TX";s:3:"zip";s:5:"75039";s:11:"countryCode";s:0:"";s:7:"country";s:
0:"";s:4:"city";s:6:"Irving";}";s:13:"addressString";s:50:"5221 North
O'Connor RoadHQL14A37,
 Irving TX 75039";}' /><gd:extendedProperty name='SAContactId'
value='' /></atom:entry></atom:feed>



mark that the postal address field contains ' (single quote),
North O'Connor
I am also passing this whole serialized contact as extended property
for my some personal use.
In response of this feed,
google API gives response like below.


HTTP/1.1 200 OK
Content-Type: application/atom+xml; charset=UTF-8; type=feed
GData-Version: 2.0
Date: Mon, 07 Feb 2011 07:17:19 GMT
Expires: Mon, 07 Feb 2011 07:17:19 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/
2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://
schemas.google.com/g/2005'><id>http://www.google.com/m8/feeds/contacts/
sumi.sheladiya%40gmail.com/full/batch/1297063039797</
id><updated>2011-02-07T07:17:19.812Z</updated><title>Batch Feed</
title><entry><id>http://www.google.com/m8/feeds/contacts/sumi.sheladiya
%40gmail.com/full/batch/1297063039797/fatal</
id><updated>2011-02-07T07:17:19.812Z</updated><title>Fatal Error</
title><content>Feed processing was interrupted.</
content><batch:interrupted reason='Element type
&quot;gd:extendedProperty&quot; must be followed by either attribute
specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.' parsed='0'
success='0' error='0' unprocessed='0'/></entry></feed>


I think the problem is with my extended property address0, what should
I do to escape '(single quote). and if using CDATA for
extendedProperty-value is solution then How can I use that?


I have tried various alternatives to replace this single quote,
1. tried replacing ' with '' , same error
2. tried replacing ' with &amps; (replaced all html entities) but in
google contacts panel it is rendering as &amps; not as ' (single
quote)
3. tried replacing ' with %27 (tried url encoding) but in google
contact panel it is rendering as %27 not as '(single quote).


I am sending header content type as
Content-type: application/atom+xml


so what should I do, to create contact with address containing
'(single quote) and also it renders as '(single quote) in google
contacts view.
waiting for your kind reply.

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to