I need to parse XML into a graph in JGraphX using Java. I get this XML from the JGraphX library and must install the graph again with this XML. Is there any JGraphX library method that converts XML to graph? I have this code below to get the XML from the graph:
try { System.out.println("call xml getting code"); mxCodec codec = new mxCodec(); String xml = mxUtils.getXml(codec.encode(graph1.getModel())); java.io.FileWriter fw = new java.io.FileWriter("E:\\my-file.xml"); fw.write(xml); fw.close(); } catch(Exception ex) { System.out.println("ERROR : "+ex.getMessage()); }
So, is there a way to get a graph from this XML? Otherwise, what should I do to generate a chart? If I try to create a graph by reading the XML one by one, it may take some time with complex algorithms, so I tried to find another library method.
source share