Commits

Anonymous committed b6f4ad8

Fix for RT #46992: GraphML: end tag of nodes before definition of their
attributes

Comments (0)

Files changed (4)

Graph-Easy/bin/graph-easy

 	  <key id="d0" for="edge" attr.name="label" attr.type="string"/>
 	
 	  <graph id="G" edgedefault="directed">
-	    <node id="Berlin"/>
-	    <node id="Bonn"/>
-	    <node id="Ulm"/>
-	    <edge source="Bonn" target="Berlin"/>
+	    <node id="Berlin">
+        </node>
+	    <node id="Bonn">
+        </node>
+	    <node id="Ulm">
+        </node>
+	    <edge source="Bonn" target="Berlin">
 	      <data key="d0">car</data>
-	    <edge source="Bonn" target="Ulm"/>
+        </edge>
+	    <edge source="Bonn" target="Ulm">
 	      <data key="d0">car</data>
+        </edge>
 	  </graph>
 	<graphml>
 

Graph-Easy/lib/Graph/Easy/As_graphml.pm

 
   my $txt = <<EOF
 <?xml version="1.0" encoding="UTF-8"?>
-<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml"
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"##Y##
-    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/graphml
+    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
      ##SCHEMA##">
 
   <!-- Created by Graph::Easy v##VERSION## at ##DATE## -->
   my ($self, $indent, $ids) = @_;
 
   my $g = $self->{graph};
-  my $txt = $indent . '<node id="' . $g->_safe_xml($self->{name}) . "\"/>\n";
+  my $txt = $indent . '<node id="' . $g->_safe_xml($self->{name}) . "\">\n";
 
   $txt .= $g->_attributes_as_graphml($self, $indent, $ids->{node});
 
-  $txt;
+  $txt .= "$indent</node>\n";
+
+  return $txt;
   }
 
 #############################################################################
 
   my $g = $self->{graph};
   my $txt = $indent . '<edge source="' . $g->_safe_xml($self->{from}->{name}) . 
-		     '" target="' . $g->_safe_xml($self->{to}->{name}) . "\"/>\n";
+		     '" target="' . $g->_safe_xml($self->{to}->{name}) . "\">\n";
 
   $txt .= $g->_attributes_as_graphml($self, $indent, $ids->{edge});
 
+  $txt .= "$indent</edge>\n";
+
   $txt;
   }
  

Graph-Easy/t/graphml.t

   </key>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
+    <node id="A">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d1">blue</data>
+    </edge>
   </graph>
 </graphml>
 EOT
   <key id="d2" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
+    <node id="A">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d1">blue</data>
       <data key="d2">train-station &amp; &lt;Überlingen &quot;Süd&quot;&gt;</data>
+    </edge>
   </graph>
 </graphml>
 EOT2
   <key id="d2" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="&lt;&amp;&apos;&quot;&gt;"/>
+    <node id="&lt;&amp;&apos;&quot;&gt;">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="&lt;&amp;&apos;&quot;&gt;" target="B"/>
+    <edge source="&lt;&amp;&apos;&quot;&gt;" target="B">
       <data key="d1">blue</data>
       <data key="d2">train-station &amp; &lt;Überlingen &quot;Süd&quot;&gt;</data>
+    </edge>
   </graph>
 </graphml>
 EOT3
   <key id="d0" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
-    <node id="B"/>
-    <node id="C"/>
+    <node id="A">
+    </node>
+    <node id="B">
+    </node>
+    <node id="C">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d0">car</data>
-    <edge source="A" target="C"/>
+    </edge>
+    <edge source="A" target="C">
       <data key="d0">train</data>
+    </edge>
   </graph>
 </graphml>
 EOT4
 $result = <<EOT5
   <graph id="G" edgedefault="directed">
     <graph id="Cities&quot;" edgedefault="directed">
-      <node id="Bonn"/>
+      <node id="Bonn">
+      </node>
     </graph>
   </graph>
 </graphml>
 
   $result = <<EOR
 <?xml version="1.0" encoding="UTF-8"?>
-<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml"
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/graphml
+    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
      http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
 
 EOR

Graph-Easy/t/graphml_yed.t

   </key>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
+    <node id="A">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d1">blue</data>
+    </edge>
   </graph>
 </graphml>
 EOT
   <key id="d2" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
+    <node id="A">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d1">blue</data>
       <data key="d2">train-station &amp; &lt;Überlingen &quot;Süd&quot;&gt;</data>
+    </edge>
   </graph>
 </graphml>
 EOT2
   <key id="d2" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="&lt;&amp;&apos;&quot;&gt;"/>
+    <node id="&lt;&amp;&apos;&quot;&gt;">
       <data key="d0">red</data>
-    <node id="B"/>
+    </node>
+    <node id="B">
+    </node>
 
-    <edge source="&lt;&amp;&apos;&quot;&gt;" target="B"/>
+    <edge source="&lt;&amp;&apos;&quot;&gt;" target="B">
       <data key="d1">blue</data>
       <data key="d2">train-station &amp; &lt;Überlingen &quot;Süd&quot;&gt;</data>
+    </edge>
   </graph>
 </graphml>
 EOT3
   <key id="d0" for="edge" attr.name="label" attr.type="string"/>
 
   <graph id="G" edgedefault="directed">
-    <node id="A"/>
-    <node id="B"/>
-    <node id="C"/>
+    <node id="A">
+    </node>
+    <node id="B">
+    </node>
+    <node id="C">
+    </node>
 
-    <edge source="A" target="B"/>
+    <edge source="A" target="B">
       <data key="d0">car</data>
-    <edge source="A" target="C"/>
+    </edge>
+    <edge source="A" target="C">
       <data key="d0">train</data>
+    </edge>
   </graph>
 </graphml>
 EOT4
 $result = <<EOT5
   <graph id="G" edgedefault="directed">
     <graph id="Cities&quot;" edgedefault="directed">
-      <node id="Bonn"/>
+      <node id="Bonn">
+      </node>
     </graph>
   </graph>
 </graphml>
 
   $result = <<EOR
 <?xml version="1.0" encoding="UTF-8"?>
-<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml"
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:y="http://www.yworks.com/xml/graphml"
-    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/graphml
+    xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
      http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd">
 
 EOR