...
You can also build your own templates according to your country.
First according to your need, select some address attribute form the Table bellow:from the table below,
Attribute type | xml XML Snippet |
---|---|
address1 | <property name="address1" value="Location.address1"/> |
address2 | <property name="address2" value="Location.address2"/> |
address3 | <property name="address3" value="Location.address3"/> |
address4 | <property name="address4" value="Location.address4"/> |
address5 | <property name="address5" value="Location.address5"/> |
address6 | <property name="address6" value="Location.address6"/> |
cityVillage | <property name="cityVillage" value="Location.cityVillage"/> |
countyDistrict | <property name="countyDistrict" value="Location.district"/> |
stateProvince | <property name="stateProvince" value="Location.stateProvince"/> |
country | <property name="country" value="Location.country"/> |
latitude | <property name="latitude" value="Location.latitude"/> |
longitude | <property name="longitude" value="Location.longitude"/> |
postalCode | <property name="postalCode" value="Location.postalCode"/> |
startDate | <property name="startDate" value="PersonAddress.startDate"/> |
endDate | <property name="endDate" value="personAddress.endDate"/> |
Add these atribut sets attributes XML in the XML as followsfollowing formate,
Code Block | ||
---|---|---|
| ||
<nameMappings class="properties"> <property name="postalCode" value="Location.postalCode"/> <property name="longitude" value="Location.longitude"/> ... others </nameMappings> |
Now define the character size for each of the attribute you selected,
Name = attribute name
value = Number of charecterscharacters
E.g.
Code Block | ||
---|---|---|
| ||
<sizeMappings class="properties"> <property name="postalCode" value="10"/> <property name="longitude" value="10"/> ... others </sizeMappings> |
Next, design the layout of for your Address Template.
This defines the top to bottom and left to right order relative positions of the address attributes to one another
E.g.
Code Block | ||
---|---|---|
| ||
<lineByLineFormat> <string>address1</string> <string>address2</string> <string>cityVillage stateProvince country postalCode</string> <string>latitude longitude</string> <string>startDate endDate</string> </lineByLineFormat> |
(OPtionalOptional) You can add default values for to the attribute attributes as bellowbelow,
E.g.
Code Block | ||
---|---|---|
| ||
<elementDefaults> <property name="country" value="Kenya"/> ... </elementDefaults> |
(OPtionalOptional) You can define Reguler regular expressions to validate input, and also help the user by giving input sugessionssuggestions
E.g.
Reguler Regular expressions to for validation;
Code Block | ||
---|---|---|
| ||
<elementRegex> <property name="longitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/> <property name="latitude" value="^(\\d{1,3}\\s)\\d\\d.(\\d{2,3})\\s*$"/> ... </elementRegex> |
Input sugessionssuggestions;
Code Block | ||
---|---|---|
| ||
<elementRegexFormats> <property name="longitude" value="123 45.000"/> <property name="latitude" value="123 45.000"/> ... </elementRegexFormats> |
Fianly you can Finlay bundle all in one xml asthe above XMLs as shown below,
Code Block | ||
---|---|---|
| ||
<addressTemplate> <nameMappings class="properties"> <property name="postalCode" value="Location.postalCode"/> ... </nameMappings> <sizeMappings class="properties"> <property name="postalCode" value="10"/> ... </sizeMappings> <lineByLineFormat> <string>address1</string> <string>address2</string> ... </lineByLineFormat> ... ... </addressTemplate> |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<addressTemplate> <nameMappings class="properties"> <property name="address2" value="Location.address2"/> <property name="stateProvince" value="Location.state"/> <property name="address1" value="Location.address1"/> <property name="postalCode" value="Location.zipCode"/> <property name="cityVillage" value="Location.city"/> </nameMappings> <sizeMappings class="properties"> <property name="address2" value="50"/> <property name="stateProvince" value="2"/> <property name="address1" value="50"/> <property name="postalCode" value="10"/> <property name="cityVillage" value="20"/> </sizeMappings> <elementDefaults class="properties"> <property name="country" value="USA"/> </elementDefaults> <lineByLineFormat> <string>address1</string> <string>address2</string> <string>cityVillage stateProvince postalCode</string> </lineByLineFormat> </addressTemplate> |
Snippet