ICU-10400 Updated the tool used for updating ICU's ISO 4217 currency numeric code map to support the new ISO 4217 file locations and format.
X-SVN-Rev: 34313
This commit is contained in:
parent
e46f248a50
commit
bac694742e
@ -11,9 +11,9 @@
|
|||||||
<property name="res.dir" value="${out.dir}/res"/>
|
<property name="res.dir" value="${out.dir}/res"/>
|
||||||
<property name="xml.dir" value="${out.dir}/xml"/>
|
<property name="xml.dir" value="${out.dir}/xml"/>
|
||||||
|
|
||||||
<property name="base.url" value="http://www.currency-iso.org/content/dam/isocy/downloads/"/>
|
<property name="base.url" value="http://www.currency-iso.org/dam/downloads/"/>
|
||||||
<property name="current.xml" value="dl_iso_table_a1.xml"/>
|
<property name="current.xml" value="table_a1.xml"/>
|
||||||
<property name="historic.xml" value="dl_iso_table_a3.xml"/>
|
<property name="historic.xml" value="table_a3.xml"/>
|
||||||
|
|
||||||
<target name="build" depends="check, resource" description="Verify ICU's local data and generate ISO 4217 alpha-numeric code mapping data resource"/>
|
<target name="build" depends="check, resource" description="Verify ICU's local data and generate ISO 4217 alpha-numeric code mapping data resource"/>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* Copyright (C) 2012, International Business Machines Corporation and *
|
* Copyright (C) 2012-2013, International Business Machines Corporation and *
|
||||||
* others. All Rights Reserved. *
|
* others. All Rights Reserved. *
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
@ -47,14 +47,29 @@ public class CurrencyDataParser {
|
|||||||
|
|
||||||
private static class Handler extends DefaultHandler {
|
private static class Handler extends DefaultHandler {
|
||||||
private enum ElementType {
|
private enum ElementType {
|
||||||
ENTITY,
|
ENTITY("CtryNm"),
|
||||||
CURRENCY,
|
CURRENCY("CcyNm"),
|
||||||
ALPHABETIC_CODE,
|
ALPHABETIC_CODE("Ccy"),
|
||||||
NUMERIC_CODE,
|
NUMERIC_CODE("CcyNbr"),
|
||||||
MINOR_UNIT,
|
MINOR_UNIT("CcyMnrUnts"),
|
||||||
WITHDRAWAL_DATE,
|
WITHDRAWAL_DATE("WthdrwlDt"),
|
||||||
REMARK,
|
REMARK("Remark"), // obsolete
|
||||||
OTHER
|
OTHER("Other"); // place holder
|
||||||
|
|
||||||
|
private String elemName;
|
||||||
|
|
||||||
|
ElementType(String elemName) {
|
||||||
|
this.elemName = elemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ElementType forName(String name) {
|
||||||
|
for (ElementType type : values()) {
|
||||||
|
if (type.elemName.equals(name)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OTHER;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Collection<CurrencyDataEntry> isoCurrencies = new LinkedList<CurrencyDataEntry>();
|
Collection<CurrencyDataEntry> isoCurrencies = new LinkedList<CurrencyDataEntry>();
|
||||||
@ -66,7 +81,7 @@ public class CurrencyDataParser {
|
|||||||
|
|
||||||
public Handler(boolean historic) {
|
public Handler(boolean historic) {
|
||||||
this.historic = historic;
|
this.historic = historic;
|
||||||
currElemName = historic ? "ISO_CURRENCY_HISTORIC" : "ISO_CURRENCY";
|
currElemName = historic ? "HstrcCcyNtry" : "CcyNtry";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<CurrencyDataEntry> getParsedISOCurrencies() {
|
public Collection<CurrencyDataEntry> getParsedISOCurrencies() {
|
||||||
@ -79,7 +94,7 @@ public class CurrencyDataParser {
|
|||||||
elem = ElementType.OTHER;
|
elem = ElementType.OTHER;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
elem = ElementType.valueOf(qName);
|
elem = ElementType.forName(qName);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
elem = ElementType.OTHER;
|
elem = ElementType.OTHER;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user