]> granicus.if.org Git - icu/commitdiff
ICU-10400 Updated the tool used for updating ICU's ISO 4217 currency numeric code...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 13 Sep 2013 18:45:24 +0000 (18:45 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 13 Sep 2013 18:45:24 +0000 (18:45 +0000)
X-SVN-Rev: 34313

tools/currency/build.xml
tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java

index c3124ebf8c7c56f7a4c2e5ee2b654688fd0d97c0..a7618f71cda1dfe5da189ccfb7c9a38785e4f95f 100644 (file)
@@ -11,9 +11,9 @@
     <property name="res.dir" value="${out.dir}/res"/>
     <property name="xml.dir" value="${out.dir}/xml"/>
 
-    <property name="base.url" value="http://www.currency-iso.org/content/dam/isocy/downloads/"/>
-    <property name="current.xml" value="dl_iso_table_a1.xml"/>
-    <property name="historic.xml" value="dl_iso_table_a3.xml"/>
+    <property name="base.url" value="http://www.currency-iso.org/dam/downloads/"/>
+    <property name="current.xml" value="table_a1.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"/>
 
index ad73d001a73c3ba737ed6317d4c46a72397b7680..332824ff5b09864a5aa286e29fb560418bae8a50 100644 (file)
@@ -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.                                                *
  *******************************************************************************
  */
@@ -47,14 +47,29 @@ public class CurrencyDataParser {
 
     private static class Handler extends DefaultHandler {
         private enum ElementType {
-            ENTITY,
-            CURRENCY,
-            ALPHABETIC_CODE,
-            NUMERIC_CODE,
-            MINOR_UNIT,
-            WITHDRAWAL_DATE,
-            REMARK,
-            OTHER
+            ENTITY("CtryNm"),
+            CURRENCY("CcyNm"),
+            ALPHABETIC_CODE("Ccy"),
+            NUMERIC_CODE("CcyNbr"),
+            MINOR_UNIT("CcyMnrUnts"),
+            WITHDRAWAL_DATE("WthdrwlDt"),
+            REMARK("Remark"),   // obsolete
+            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>();
@@ -66,7 +81,7 @@ public class CurrencyDataParser {
 
         public Handler(boolean historic) {
             this.historic = historic;
-            currElemName = historic ? "ISO_CURRENCY_HISTORIC" : "ISO_CURRENCY";
+            currElemName = historic ? "HstrcCcyNtry" : "CcyNtry";
         }
 
         public Collection<CurrencyDataEntry> getParsedISOCurrencies() {
@@ -79,7 +94,7 @@ public class CurrencyDataParser {
                 elem = ElementType.OTHER;
             } else {
                 try {
-                    elem = ElementType.valueOf(qName);
+                    elem = ElementType.forName(qName);
                 } catch (IllegalArgumentException e) {
                     elem = ElementType.OTHER;
                 }