问题
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