Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit 7d47ed0

Browse files
fix: correct GraphML namespace URL in GraphMLExporter
The exporter was using http://graphml.graphstruct.org/xmlns which is not a valid GraphML namespace. The correct namespace per the GraphML specification (http://graphml.graphdrawing.org/) is http://graphml.graphdrawing.org/xmlns. The wrong namespace caused exported .graphml files to be rejected by standard parsers in Gephi, Cytoscape, NetworkX, yEd, and igraph that validate the namespace URI on import. Fixed all three occurrences in the XML header (xmlns, schemaLocation namespace, schemaLocation URL) and updated the corresponding test assertion. Fixes #20
1 parent 37f7cb1 commit 7d47ed0

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Gvisual/src/gvisual/GraphMLExporter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ private String exportToString(List<edge> edgesToExport) {
134134

135135
// XML header
136136
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
137-
sb.append("<graphml xmlns=\"http://graphml.graphstruct.org/xmlns\"\n");
137+
sb.append("<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"\n");
138138
sb.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
139-
sb.append(" xsi:schemaLocation=\"http://graphml.graphstruct.org/xmlns\n");
140-
sb.append(" http://graphml.graphstruct.org/xmlns/1.0/graphml.xsd\">\n");
139+
sb.append(" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns\n");
140+
sb.append(" http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n");
141141

142142
// Key definitions for node and edge attributes
143143
sb.append(" <!-- Node attribute keys -->\n");

Gvisual/test/gvisual/GraphMLExporterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public void testGraphMLNamespace() {
431431
GraphMLExporter exporter = new GraphMLExporter(graph, allEdges);
432432
String xml = exporter.exportToString();
433433

434-
assertTrue(xml.contains("xmlns=\"http://graphml.graphstruct.org/xmlns\""));
434+
assertTrue(xml.contains("xmlns=\"http://graphml.graphdrawing.org/xmlns\""));
435435
assertTrue(xml.contains("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""));
436436
}
437437

0 commit comments

Comments
 (0)