Exemplo n.º 1
0
 /**
  * Example constructor shows how to create and start an XML parser.
  *
  * @param db_path Path to the XML file to be parsed.
  */
 public GraphDB(String db_path) {
   nodeMap = new HashMap<>();
   locations = new Trie();
   try {
     File inputFile = new File(db_path);
     SAXParserFactory factory = SAXParserFactory.newInstance();
     SAXParser saxParser = factory.newSAXParser();
     // we pass this to the MapDBHandler, all the state records can be taken care at MapDBHandler
     MapDBHandler maphandler = new MapDBHandler(this);
     saxParser.parse(inputFile, maphandler);
   } catch (ParserConfigurationException | SAXException | IOException e) {
     e.printStackTrace();
   }
   clean();
 }