code: function parse(xml) {
      var doc;
      if (typeof xml === 'string') {
          var parser = new DOMParser();
          doc = parser.parseFromString(xml, 'text/xml');
      }
      else {
          doc = xml;
      }
      if (!doc || doc.getElementsByTagName('parsererror').length) {
          return null;
      }
  
      var gexfRoot = getChildByTagName(doc, 'gexf');
  
      if (!gexfRoot) {
          return null;
      }
  
      var graphRoot = getChildByTagName(gexfRoot, 'graph');
  
      var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes'));
      var attributesMap = {};
      for (var i = 0; i < attributes.length; i++) {
          attributesMap[attributes[i].id] = attributes[i];
      }
  
      return {
          nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap),
          links: parseEdges(getChildByTagName(graphRoot, 'edges'))
      };
  }
docs: GEXF File Parser http://gexf.net/1.2draft/gexf-12draft-primer.pdf