vCard Parsing different parameters

随声附和 提交于 2019-12-25 00:50:21

问题


I need to write a vCard Parser. Now the problem is that the Vcard I get can have n number of paramenters Like say TEL;CELL:123 or TEL;CELL;VOICE:123 or TEL:HOME;CELL;VOICE:123 now how i get this format really depends on my sources(which can be diverse and many). Now I need to make a generic reader which can identify tht all these different set of parameters can map to a single field(in this case Mobile number), but the way of sending this information varies across all sources(google, MS, Nokia). can someone please give any suggestion on how to handle such situation


回答1:


vCard is a bloody mess to parse, especially since almost nothing out there produces RFC 2426-compliant output. For similar reasons I ended up writing a vCard parser / validator which you can use to massage the data into compliance. I use it daily to keep my own vCards (a few hundred people/companies) compliant, and the result has for example been that Gmail now imports all of them properly, address, phones, images and all.



来源:https://stackoverflow.com/questions/5729405/vcard-parsing-different-parameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!