KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > blackberry > parser > XMLContactParser


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.syncclient.blackberry.parser;
20
21 import java.util.Hashtable JavaDoc;
22 import java.util.Vector JavaDoc;
23
24 import javax.microedition.pim.Contact;
25 import javax.microedition.pim.ContactList;
26 import javax.microedition.pim.PIMItem;
27
28 import sync4j.syncclient.common.StringTools;
29
30 import sync4j.syncclient.util.StaticDataHelper;
31
32 import net.rim.device.api.ui.component.Dialog;
33
34 /**
35  * <code>XMLContactParser</code> provides with the user interface
36  * for sync contacts with SyncServer.
37  *
38  * @author santoshs email:info@telibrahma.com
39  * @author Fabio Maggi @ Funambol
40  * $Id: XMLContactParser.java,v 1.0
41  */

42
43 public class XMLContactParser implements ContactParser{
44
45         //------------------------------------------Private Data Constants
46

47     private static final String JavaDoc FIRST_NAME = "FirstName" ;
48     private static final String JavaDoc LAST_NAME = "LastName" ;
49     private static final String JavaDoc TITLE = "JobTitle" ;
50     private static final String JavaDoc COMPANY = "CompanyName" ;
51     private static final String JavaDoc EMAIL_1 = "Email1Address" ;
52     private static final String JavaDoc INSTANT_MESSENGER = "IstantMessenger" ;
53     private static final String JavaDoc WEB_PAGE = "WebPage" ;
54     private static final String JavaDoc MOBILE_TEL = "MobileTelephoneNumber" ;
55     private static final String JavaDoc HOME_FAX = "HomeFaxNumber" ;
56     private static final String JavaDoc BUSINESS_FAX = "BusinessFaxNumber" ;
57     private static final String JavaDoc BUSINESS_TEL = "BusinessTelephoneNumber" ;
58     private static final String JavaDoc BUSINESS_TEL2 = "Business2TelephoneNumber" ;
59     private static final String JavaDoc HOME_TEL = "HomeTelephoneNumber" ;
60     private static final String JavaDoc BUSINESS_STREET = "BusinessAddressStreet" ;
61     private static final String JavaDoc BUSINESS_CITY = "BusinessAddressCity" ;
62     private static final String JavaDoc BUSINESS_STATE = "BusinessAddressState" ;
63     private static final String JavaDoc BUSINESS_COUNTRY = "BusinessAddressCountry" ;
64     private static final String JavaDoc BUSINESS_PO = "BusinessAddressPostalCode" ;
65     private static final String JavaDoc HOME_STREET = "HomeAddressStreet" ;
66     private static final String JavaDoc HOME_CITY = "HomeAddressCity" ;
67     private static final String JavaDoc HOME_STATE = "HomeAddressState" ;
68     private static final String JavaDoc HOME_COUNTRY = "HomeAddressCountry" ;
69     private static final String JavaDoc HOME_PO = "HomeAddressPostalCode" ;
70     private static final String JavaDoc NOTE = "Body" ;
71
72     private static final String JavaDoc START_MARKER = "<contact>" ;
73     private static final String JavaDoc END_MARKER = "</contact>" ;
74
75     //------------------------------------------Private Data menmbers
76

77     private String JavaDoc[] tagArray = {
78             FIRST_NAME ,
79             LAST_NAME ,
80             EMAIL_1 ,
81             COMPANY ,
82             TITLE ,
83             INSTANT_MESSENGER ,
84             WEB_PAGE ,
85             MOBILE_TEL ,
86             HOME_FAX ,
87             BUSINESS_FAX ,
88             BUSINESS_TEL ,
89             BUSINESS_TEL2 ,
90             HOME_TEL ,
91             BUSINESS_STREET ,
92             BUSINESS_CITY ,
93             BUSINESS_STATE ,
94             BUSINESS_COUNTRY ,
95             BUSINESS_PO ,
96             HOME_STREET ,
97             HOME_CITY ,
98             HOME_STATE ,
99             HOME_COUNTRY ,
100             HOME_PO ,
101             NOTE
102     };
103
104     private String JavaDoc[] telAttrs = {
105             MOBILE_TEL ,
106             BUSINESS_FAX ,
107             BUSINESS_TEL ,
108             HOME_TEL
109     };
110
111     private ContactList list;
112     private Contact contact;
113     private boolean modify;
114
115     /**
116      * This is an initialization constructor for XMLContactParser class.
117      *
118      * @param ContactList: Blackberry contact list
119      * @param Contact: Blackberry contact
120      * @param boolean: to modify or not to modify
121      * @return XMLContactParser
122      */

123     public XMLContactParser(ContactList list, Contact contact, boolean modify) {
124         this.list = list;
125         this.contact = contact;
126         this.modify = modify;
127     }
128
129     /**
130      * This method is invoked to obtain Contact object from a contact String.
131      * if the modify flag is set to true it modifies the contact.
132      * if the modify flag is set to false it simply adds a contact to blackberry addressbook.
133      *
134      * @param String:String containing contact information to be parsed.
135      * @return Contact: that has been added newly/modified in blackberry addressbook.
136      */

137     public Contact parseContact(String JavaDoc contactString) {
138         if(modify)
139             return modifyContact(contactString);
140         else
141             return addContact(contactString);
142     }
143
144     /**
145      * This method is invoked to obtain Contact object from a contact String,
146      * when a contact is added to the blackberry addressbook.This method
147      * adds a new contact and returns the reference of that object.
148      *
149      * @param String: String containing contact information to be parsed.
150      * @return Contact: Contact object that has been added newly.
151      */

152     public Contact addContact(String JavaDoc contactString) {
153
154         Hashtable JavaDoc contactMap = buildMapFromXML(contactString);
155                 
156         if (contactMap != null) {
157             try {
158                 String JavaDoc[] arrayField = new String JavaDoc[5];
159
160                 arrayField[Contact.NAME_FAMILY] = getValue(contactMap, LAST_NAME);
161
162                 arrayField[Contact.NAME_GIVEN] = getValue(contactMap, FIRST_NAME);
163
164                 if (list.isSupportedField(Contact.NAME)) {
165                      contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, arrayField);
166                 }
167
168                 String JavaDoc field = getValue(contactMap, EMAIL_1);
169
170                 if (isSupportedField(Contact.EMAIL, field)) {
171                     contact.addString(Contact.EMAIL, Contact.ATTR_NONE, field);
172                 }
173
174                 field = getValue(contactMap, NOTE);
175                 if (isSupportedField(Contact.NOTE, field)) {
176                     contact.addString(Contact.NOTE, Contact.ATTR_NONE, field);
177                 }
178
179                 field = getValue(contactMap, TITLE);
180                 if (isSupportedField(Contact.TITLE, field)) {
181                     contact.addString(Contact.TITLE, Contact.ATTR_NONE, field);
182                 }
183
184                 field = getValue(contactMap, COMPANY);
185                 if (isSupportedField(Contact.ORG, field)) {
186                     contact.addString(Contact.ORG, Contact.ATTR_NONE, field);
187                 }
188
189                 field = getValue(contactMap, WEB_PAGE);
190                 if (isSupportedField(Contact.URL, field)) {
191                     contact.addString(Contact.URL, Contact.ATTR_NONE, field);
192                 }
193
194                 field = getValue(contactMap, HOME_TEL);
195                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_HOME, field)) {
196                         contact.addString(Contact.TEL, Contact.ATTR_HOME, field);
197                 }
198
199                 field = getValue(contactMap, MOBILE_TEL);
200                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_MOBILE, field)) {
201                         contact.addString(Contact.TEL, Contact.ATTR_MOBILE, field);
202                 }
203
204                 field = getValue(contactMap, BUSINESS_TEL);
205                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_WORK, field)) {
206                         contact.addString(Contact.TEL, Contact.ATTR_WORK, field);
207                 }
208
209                 field = getValue(contactMap, BUSINESS_FAX);
210
211                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_FAX, field)) {
212                         contact.addString(Contact.TEL, Contact.ATTR_FAX, field);
213                 }
214                 arrayField = new String JavaDoc[7];
215                 arrayField[Contact.ADDR_COUNTRY] = getValue(contactMap, HOME_COUNTRY );
216                 arrayField[Contact.ADDR_STREET] = getValue(contactMap, HOME_STREET );
217                 arrayField[Contact.ADDR_REGION] = getValue(contactMap, HOME_STATE );
218                 arrayField[Contact.ADDR_LOCALITY] = getValue(contactMap, HOME_CITY );
219                 arrayField[Contact.ADDR_POSTALCODE] = getValue(contactMap, HOME_PO );
220
221                 if (list.isSupportedField(Contact.ADDR)) {
222                     contact.addStringArray(Contact.ADDR, Contact.ATTR_WORK, arrayField);
223                 }
224
225                 arrayField = new String JavaDoc[7];
226                 arrayField[Contact.ADDR_COUNTRY] = getValue(contactMap, HOME_COUNTRY );
227                 arrayField[Contact.ADDR_STREET] = getValue(contactMap, HOME_STREET );
228                 arrayField[Contact.ADDR_REGION] = getValue(contactMap, HOME_STATE );
229                 arrayField[Contact.ADDR_LOCALITY] = getValue(contactMap, HOME_CITY );
230                 arrayField[Contact.ADDR_POSTALCODE] = getValue(contactMap, HOME_PO );
231                 if (list.isSupportedField(Contact.ADDR) && list.isSupportedAttribute(Contact.ADDR, Contact.ATTR_HOME))
232                         contact.addStringArray(Contact.ADDR, Contact.ATTR_HOME, arrayField);
233               
234                 return contact;
235             } catch (Exception JavaDoc e) {
236                 e.printStackTrace();
237                 return null;
238             }
239         }
240         return null;
241     }
242
243     /**
244      * This method is invoked to obtain Contact object from a contact String,
245      * when a contact is modified in the blackberry addressbook.This method
246      * modifies the object and returns the reference to that object.
247      *
248      * @param String: String containing contact information to be parsed.
249      * @return Contact:Contact that has been modified.
250      */

251     public Contact modifyContact(String JavaDoc contactString) {
252
253         Hashtable JavaDoc contactMap = buildMapFromXML(contactString);
254         if (contactMap != null) {
255             try {
256                 String JavaDoc[] arrayField = new String JavaDoc[5];
257                 arrayField[Contact.NAME_FAMILY] = getValue(contactMap, LAST_NAME);
258                 arrayField[Contact.NAME_GIVEN] = getValue(contactMap, FIRST_NAME);
259                 if(contact.countValues(Contact.NAME) > 0) {
260                     contact.setStringArray(Contact.NAME, 0, Contact.ATTR_NONE, arrayField);
261                 } else {
262                     contact.addStringArray(Contact.NAME, Contact.ATTR_NONE, arrayField);
263                 }
264
265                 String JavaDoc field = getValue(contactMap, EMAIL_1);
266                 if (isSupportedField(Contact.EMAIL, field) && contact.countValues(Contact.EMAIL) > 0) {
267                     contact.setString(Contact.EMAIL, 0, Contact.ATTR_NONE, field);
268                 } else {
269                     contact.addString(Contact.EMAIL, Contact.ATTR_NONE, field);
270                 }
271
272                 field = getValue(contactMap, NOTE);
273                 if (isSupportedAtrributedField(Contact.NOTE, Contact.ATTR_NONE, field)) {
274                         contact.removeValue(Contact.NOTE, 0);
275                         contact.addString(Contact.NOTE, Contact.ATTR_NONE, field);
276                 }
277
278                 field = getValue(contactMap, COMPANY);
279                 if (isSupportedField(Contact.ORG, field) && contact.countValues(Contact.ORG) > 0) {
280                     contact.setString(Contact.ORG, 0, Contact.ATTR_NONE, field);
281                 } else {
282                     contact.addString(Contact.ORG, Contact.ATTR_NONE, field);
283                 }
284
285                 field = getValue(contactMap, TITLE);
286                 if (isSupportedAtrributedField(Contact.TITLE, Contact.ATTR_NONE, field)) {
287                         contact.removeValue(Contact.TITLE, 0);
288                         contact.addString(Contact.TITLE, Contact.ATTR_NONE, field);
289                 }
290
291                 if( isSupportedField(Contact.URL, field) && contact.countValues(Contact.URL) > 0) {
292                     contact.removeValue(Contact.URL, 0);
293                     field = getValue(contactMap, WEB_PAGE);
294                     contact.addString(Contact.URL, Contact.ATTR_NONE, field);
295                 }
296
297                 int telValues = contact.countValues(Contact.TEL);
298                 for(int i=0; i<telValues;i++) {
299                     contact.removeValue(Contact.TEL, 0);
300                 }
301
302                 field = getValue(contactMap, HOME_TEL);
303                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_HOME, field))
304                         contact.addString(Contact.TEL, Contact.ATTR_HOME, field);
305
306                 field = getValue(contactMap, MOBILE_TEL);
307                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_MOBILE, field))
308                         contact.addString(Contact.TEL, Contact.ATTR_MOBILE, field);
309
310                 field = getValue(contactMap, BUSINESS_TEL);
311                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_WORK, field))
312                         contact.addString(Contact.TEL, Contact.ATTR_WORK, field);
313
314                 field = getValue(contactMap, BUSINESS_FAX);
315                 if (isSupportedAtrributedField(Contact.TEL, Contact.ATTR_FAX, field))
316                         contact.addString(Contact.TEL, Contact.ATTR_FAX, field);
317
318                 arrayField = new String JavaDoc[7];
319                 arrayField[Contact.ADDR_COUNTRY] = getValue(contactMap, BUSINESS_COUNTRY );
320                 arrayField[Contact.ADDR_STREET] = getValue(contactMap, BUSINESS_STREET );
321                 arrayField[Contact.ADDR_REGION] = getValue(contactMap, BUSINESS_STATE );
322                 arrayField[Contact.ADDR_LOCALITY] = getValue(contactMap, BUSINESS_CITY );
323                 arrayField[Contact.ADDR_POSTALCODE] = getValue(contactMap, BUSINESS_PO );
324
325                 if (list.isSupportedField(Contact.ADDR) && contact.countValues(Contact.ADDR) > 0)
326                     contact.setStringArray(Contact.ADDR, 0, Contact.ATTR_WORK, arrayField);
327                 else
328                     contact.addStringArray(Contact.ADDR, Contact.ATTR_WORK, arrayField);
329
330                 return contact;
331             } catch (Exception JavaDoc e) {
332                 e.printStackTrace();
333                 return null;
334             }
335         }
336         return null;
337     }
338
339     /**
340      * This method appends all the contact information passed to it
341      * in the form of contact object.
342      *
343      * @param Contact: Blackberry contact.
344      * @return String: all contact information in a string format.
345      */

346     public String JavaDoc toString(Contact contact) {
347
348         StringBuffer JavaDoc contactBuffer = new StringBuffer JavaDoc();
349
350         contactBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
351
352         contactBuffer.append("<contact>\n");
353
354         appendName (contactBuffer ,
355                                contact );
356
357         appendField (contactBuffer ,
358                                contact ,
359                                Contact.ORG ,
360                                COMPANY );
361
362         appendField (contactBuffer ,
363                                contact ,
364                                Contact.NOTE ,
365                                NOTE );
366
367         appendField (contactBuffer ,
368                                contact ,
369                                Contact.TITLE ,
370                                TITLE );
371
372         appendField (contactBuffer ,
373                                contact ,
374                                Contact.EMAIL ,
375                                EMAIL_1 );
376
377         appendField (contactBuffer ,
378                                contact ,
379                                Contact.URL ,
380                                WEB_PAGE );
381
382         appendTelephoneFields (contactBuffer ,
383                                contact );
384
385         appendAddress (contactBuffer ,
386                                contact );
387
388         contactBuffer.append("</contact>");
389
390         return contactBuffer.toString();
391     }
392
393     //-----------------------------------------Private Methods
394

395     /**
396      * This method appends the contact information supported by blackberry to a
397      * string buffer.
398      *
399      * @param StringBuffer: StringBuffer containing contact information.
400      * @param Contact: Blackberry contact
401      * @param int: type of field
402      * @param String: Name of field.
403      * @return void.
404      */

405     private void appendField(StringBuffer JavaDoc contactBuffer, Contact contact, int field, String JavaDoc tag) {
406
407         String JavaDoc value = null;
408
409         if (list.isSupportedField(field)) {
410
411             value = "";
412
413             try {
414                 value = contact.getString(field, 0);
415             } catch (Exception JavaDoc e) {
416                 StaticDataHelper.log("Not set field: " + tag);
417             }
418
419             appendToContact(contactBuffer, tag, value);
420
421         }
422     }
423
424     /**
425      * This method appends the contact information supported by blackberry to a
426      * string buffer.
427      *
428      * @param StringBuffer: StringBuffer containing contact information.
429      * @param String: name of tag associated with contact information.
430      * @param String: value corresponding to tag.
431      * @return void
432      */

433     private void appendToContact(StringBuffer JavaDoc contactBuffer, String JavaDoc tag, String JavaDoc value) {
434
435         value = (value == null) ? "" : value;
436
437         if (value.length() > 0) {
438             value = StringTools.escapeXml(value);
439         }
440
441         contactBuffer.append("<").append(tag).append(">").append(value);
442         contactBuffer.append("</").append(tag).append(">\n");
443
444     }
445
446     /**
447      * This method only appends the data corresponding to contact's name.
448      *
449      * @param StringBuffer: string buffer to which data is appended.
450      * @param Contact: Blackberry contact
451      * @return void
452      */

453     private void appendName(StringBuffer JavaDoc buffer, Contact contact) {
454         String JavaDoc[] name = contact.getStringArray(Contact.NAME, 0);
455         appendToContact(buffer, FIRST_NAME, name[Contact.NAME_GIVEN]);
456         appendToContact(buffer, LAST_NAME, name[Contact.NAME_FAMILY]);
457     }
458
459     /**
460      * This method only appends the data corresponding to contact's telephone numbers.
461      *
462      * @param StringBuffer: Blackberry contact list
463      * @param Contact: Blackberry contact
464      * @return void
465      */

466     private void appendTelephoneFields(StringBuffer JavaDoc buffer , Contact contact) {
467         int totalTelFields = contact.countValues(Contact.TEL);
468         Vector JavaDoc addedAttrs = new Vector JavaDoc();
469         for(int i=0;i<totalTelFields;i++) {
470             String JavaDoc value = contact.getString(Contact.TEL, i);
471             int attr = contact.getAttributes(Contact.TEL, i);
472             String JavaDoc tag = "";
473             switch(attr) {
474                 case Contact.ATTR_MOBILE:
475                     tag = MOBILE_TEL;
476                     break;
477                 case Contact.ATTR_FAX:
478                     tag = BUSINESS_FAX;
479                     break;
480                 case Contact.ATTR_WORK:
481                     tag = BUSINESS_TEL;
482                     break;
483                 case Contact.ATTR_HOME:
484                     tag = HOME_TEL;
485                     break;
486             }
487             if(!tag.equals("")) {
488                 appendToContact(buffer, tag, value);
489                 addedAttrs.addElement(tag);
490             }
491         }
492
493         for (int i = 0; i < telAttrs.length; i++) {
494             if(!addedAttrs.contains(telAttrs[i]))
495                 appendToContact(buffer, telAttrs[i], "");
496         }
497     }
498
499     /**
500      * This method only appends the data corresponding to contact's address details.
501      *
502      * @param StringBuffer: Blackberry contact list
503      * @param Contact: Blackberry contact
504      * @return void
505      */

506     private void appendAddress(StringBuffer JavaDoc buffer, Contact contact) {
507         if (list.isSupportedField(Contact.ADDR) && contact.countValues(Contact.ADDR) > 0) {
508             String JavaDoc[] addr = contact.getStringArray(Contact.ADDR, 0);
509             appendToContact(buffer, BUSINESS_STREET , addr[Contact.ADDR_STREET] );
510             appendToContact(buffer, BUSINESS_STATE , addr[Contact.ADDR_REGION] );
511             appendToContact(buffer, BUSINESS_CITY , addr[Contact.ADDR_LOCALITY] );
512             appendToContact(buffer, BUSINESS_PO , addr[Contact.ADDR_POSTALCODE] );
513             appendToContact(buffer, BUSINESS_COUNTRY , addr[Contact.ADDR_COUNTRY] );
514         } else {
515             appendToContact(buffer, BUSINESS_STREET , "");
516             appendToContact(buffer, BUSINESS_STATE , "");
517             appendToContact(buffer, BUSINESS_CITY , "");
518             appendToContact(buffer, BUSINESS_PO , "");
519             appendToContact(buffer, BUSINESS_COUNTRY , "");
520         }
521     }
522
523     /**
524      * This method returns the value associated with a key in a hashtable
525      * containing contactMap.
526      *
527      * @param Hashtable: contactMap
528      * @param String: key to which associated value it to be found.
529      * @return String: Value associated with the key
530      */

531     private String JavaDoc getValue(Hashtable JavaDoc contactMap, String JavaDoc key) {
532         Object JavaDoc val = contactMap.get(key);
533         String JavaDoc value = val == null ? "" : val.toString();
534         return value.trim();
535     }
536
537     /**
538      * This method checks if the field and attibute are supported by the contact list
539      * of blackberry address book
540      *
541      * @param int: field
542      * @param int: attribute
543      * @param String: value
544      * @return boolean:returns true if both the field and attribute
545      * associated with it r supported
546      */

547     private boolean isSupportedAtrributedField(int field, int attribute, String JavaDoc value) {
548         return isSupportedField(field, value) && list.isSupportedAttribute(field, attribute);
549     }
550
551     /**
552      * This method checks if the type of field is supported by the contact list
553      * of blackberry address book.
554      *
555      * @param int: type
556      * @param String: value
557      * @return boolean:returns true if contact list supports this field
558      */

559     private boolean isSupportedField(int type, String JavaDoc value) {
560         return list.isSupportedField(type);
561     }
562
563     /**
564      * This method creates a hashtable with keys and values associated with
565      * blackberry contactlist attributes.
566      *
567      * @param String: contactString
568      * @return Hashtable
569      */

570     private Hashtable JavaDoc buildMapFromXML(String JavaDoc contactString) {
571         int startMarkerIndex = contactString.indexOf(START_MARKER);
572         int endMarkerIndex = contactString.indexOf(END_MARKER);
573
574         if(startMarkerIndex == -1 || endMarkerIndex == -1) {
575             Dialog.inform("Improper data from the server.");
576             return null;
577         }
578
579         Hashtable JavaDoc contactMap = new Hashtable JavaDoc();
580         String JavaDoc startTag = "";
581         String JavaDoc endTag = "";
582         String JavaDoc degeneratedTag = "";
583         String JavaDoc data = "";
584
585         for (int i = 0; i < tagArray.length; i++) {
586             String JavaDoc tag = tagArray[i];
587
588             startTag = "<" +tag + ">";
589
590             int startTagIndex = contactString.indexOf(startTag);
591             if(startTagIndex == -1) {
592                 continue;
593             }
594
595             degeneratedTag = "<" + tag +"/>";
596             int degeneratedTagIndex = contactString.indexOf(degeneratedTag);
597             if(degeneratedTagIndex != -1) {
598                 continue;
599             }
600
601             endTag = "</"+tag+">";
602
603             int endTagIndex = contactString.indexOf(endTag);
604             if(endTagIndex != -1) {
605                 data = contactString.substring(startTagIndex+startTag.length(), endTagIndex);
606             } else {
607                 data = "";
608             }
609
610             if (data.length() > 0) {
611                 data = StringTools.unescapeXml(data);
612             }
613
614             contactMap.put(tag, data);
615         }
616         return contactMap;
617     }
618 }
619
Popular Tags