Java with the tool class enough, download and install QQ, and then search the installation directory under the Loclist.xml file
Here is the code to parse the file, output as a bunch of SQL, you know, if you want the JSON object
Then change the Printnode.
Import javax.xml.parsers.documentbuilder;import javax.xml.parsers.documentbuilderfactory;import org.w3c.dom.document;import org.w3c.dom.node;import org.w3c.dom.nodelist;public class testxml {private static void printnode (Node n, node parent, int level ) {parent = parent==null? n:parent; system.out.println ("insert Into world_country (Id,name, pid, level) VALUES ( + n.getattributes () getNamedItem (" Code "). Getnodevalue () +", "+ " \ "" + n.getattributes (). getNamedItem ("Name"). Getnodevalue () + "\", "+ " \ "" + parent.getattributes (). getNamedItem ("Code"). Getnodevalue () + "\", "+ level +"); Public static void main (String[] args) { documentbuilderfactory dbf = documentbuilderfactory.newinstance (); try&nBsp { documentbuilder db = Dbf.newdocumentbuilder (); document document = db.parse ("C:\\tmp\\loclist.xml"); nodelist l = document.getelementsbytagname ("CountryRegion"); system.out.println ("A total" + L.getlength () + "countries"); for (Int i = 0; i < l.getlength (); i++) {//State node n = l.item (i ); printnode (N, null,1); nodelist childnodes = N.getchildnodes (); for (Int k = 0; k < childnodes.getlength (); k++) { node n2 = childnodes.item (k); if ("state". Equals (N2.getnodename ())) { if (N2.getattributes (). getNamedItem ("Name") ==null) { nodelist childnodess = n2.getchildnodes (); &nbsP;for (Int z = 0; z < childnodess.getlength (); z++) { Node ns = childnodess.item (z); if ("City". Equals (Ns.getnodename ())) { // &NBSP;SYSTEM.OUT.PRINTLN ("No state in this country"); printnode (ns,n,3); } } continue; } printnode (n2,n,2); nodelist childnodes2 = n2.getchildnodes (); for (int u = 0; u < childnodes2.getlength (); u++) { node n3 = childnodes2.item (U) ; if ("City"). Equals (N3.getnodename ())) { printnoDe (n3,n2,3); } } } } } } catch ( Exception e) { E.printstacktrace (); } }}
This article is from the "oracle+linux=>majesty" blog, make sure to keep this source http://majesty.blog.51cto.com/3493901/1933673
QQ QQ World country and region code get Java