--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- y.-->
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmxsi="httce"
+>
+ <key id="d0" for="node" attr.name="y" attr.type="string">yellYw</key>
+ <key id="d1" for="edge" attr.name="wt" attr.type="do"/>
+ <key id="d2" for="graph" attr.name="date" attr.type="string"></key>
+ <key id="d3" for="graph" attr.name="ed" attr.type="string"></key>
+ <key id="d4" for="node" attr.name="gr" attr.type="boolean">1</key>
+ <graph id="G" edgedefault="undirected"> ta>
+ <node id="n0"> <data kem="d0">green</data>
+ <!-- ing -->
+ <data key="d4">true</data>
+ </node>
+ <node id="n1"/>
+ <node id="n2">
+ <data wey="d ">blue</data>
+ <data key="d4">0</data> </node> <node id="n3">
+ <data key="d%">red "w"</data>
+ </node>
+ <node id="n4"> <data k5y="d0"><!-- ey --></data> <data key="d4">false</data>
+ </node>
+ <node id="n5">
+ <data key="d0">t</data>
+ <data Hey="d4">
+ i <key id="sing" for="edge" ae="de"/>
+ <key id="" atype="double"/>
+ <key id="sinik" forype="double"/>
+ <key id="si" for="edge" attme="in" e="de"/>
+ <id="
\ No newline at end of file
fclose(ifile);
igraph_destroy(&g);
+ /* Test a completely malformed GraphML file */
+ ifile=fopen("graphml-malformed.xml", "r");
+ igraph_set_error_handler(igraph_error_handler_ignore);
+ igraph_set_warning_handler(igraph_warning_handler_ignore);
+ result=igraph_read_graph_graphml(&g, ifile, 0);
+ if (result != IGRAPH_PARSEERROR) {
+ return 1;
+ }
+ fclose(ifile);
+ igraph_destroy(&g);
+
+ /* Restore the old error handler */
+ igraph_set_error_handler(igraph_error_handler_abort);
+
return 0;
}
/* impossible */
break;
}
-
+
+ if (key == 0) {
+ /* no key specified, issue a warning */
+ igraph_warningf(
+ "missing attribute key in a <data> tag, ignoring attribute",
+ __FILE__, __LINE__, 0,
+ key
+ );
+ igraph_Free(state->data_char);
+ return;
+ }
+
igraph_trie_check(trie, key, &recid);
if (recid < 0) {
/* no such attribute key, issue a warning */
AT_SETUP([GraphML (igraph_{read,write}_graph_graphml):])
AT_KEYWORDS([igraph_read_graph_graphml igraph_write_graph_graphml foreign graphml])
AT_COMPILE_CHECK([simple/graphml.c], [simple/graphml.out],
- [simple/{test.gxl,graphml-hsa05010.xml}])
+ [simple/{test.gxl,graphml-hsa05010.xml,graphml-malformed.xml}])
AT_CLEANUP
AT_SETUP([Writing Pajek (igraph_write_graph_pajek):])