mangstadt / ez-vcard

A vCard parser library for Java
Other
405 stars 93 forks source link

Raw property values #136

Closed mangstadt closed 1 year ago

mangstadt commented 1 year ago

Email from Mario:

Hi Mike,

have already asked in the past something about the ezvcard library.

Have another question for you: is there any low-level method to get the raw value of a vCard property ?

For example, I would like to get the value of the ADR property as an array or a list instead of getting the values from the properties of the Address class.

Thanks a bunch in advance,

Mario

mangstadt commented 1 year ago

The only way to do that would be to create a custom property scribe. https://github.com/mangstadt/ez-vcard/blob/master/src/test/java/ezvcard/issue/Issue136.java

If you want low-level control over how a vCard is parsed, you could use the vinnie library. ez-vcard uses this library. https://github.com/mangstadt/vinnie/

mangstadt commented 1 year ago

Hi Mike,

thanks a lot for your quick reply.

Maybe my question might sound weird but it's supported by a solid reason.

I'm coauthor of https://datatracker.ietf.org/doc/draft-ietf-calext-vcard-jscontact-extensions/.

The next version is extending the address components to support non-western postal address schemes.

Have already tested that ezvcard parsing methods don't fail when the address components array includes more items than those expected but i cant' get them.

I use ezvcard to test the conversion rules described in https://datatracker.ietf.org/doc/draft-ietf-calext-jscontact-vcard/

I'll try to follow your suggestions.

Thanks a lot,

Mario

mangstadt commented 1 year ago

If an ADR property has more than 7 components, ez-vcard will ignore everything after the 7th component.

https://github.com/mangstadt/ez-vcard/blob/master/src/main/java/ezvcard/io/scribe/AddressScribe.java#L195

The only way to get all of the data would be to create a custom property scribe, as described in my previous email. This overrides the default ADR parsing logic and allows you to define your own. Hope that helps.

mangstadt commented 1 year ago

Hi Mike,

thanks a lot for the heads up. Have successfully extended the ADR property.

Best, Mario