Skip to content

graphwalker-cli: Converting .dot to graphml produces redundant double quotes #238

@neofreko

Description

@neofreko

Steps to reproduce

Given the following quoted-node.dot file:

digraph SimplestGraph {
    "n0" [label="Start"]
    "n1" [label="v1"]
    "n2" [label="v2"]
}

graphwalker-cli conversion with the following command:

java -jar ~/Downloads/graphwalker-cli-4.2.0.jar convert -i quoted-node.dot -f graphml

will produce the following output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd" xmlns:y="http://www.yworks.com/xml/graphml">
  <key id="d0" for="node" yfiles.type="nodegraphics"/>
  <key id="d1" for="edge" yfiles.type="edgegraphics"/>
  <graph id="G" edgedefault="directed">
    <node id=""n1"">
      <data key="d0" >
        <y:ShapeNode >
          <y:Geometry  x="241.875" y="158.701171875" width="95.0" height="30.0"/>
          <y:Fill color="#CCCCFF"  transparent="false"/>
          <y:BorderStyle type="line" width="1.0" color="#000000" />
          <y:NodeLabel x="1.5" y="5.6494140625" width="92.0" height="18.701171875" visible="true" alignment="center" fontFamily="Dialog" fontSize="12" fontStyle="plain" textColor="#000000" modelName="internal" modelPosition="c" autoSizePolicy="content">v1</y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
    <node id=""n2"">
      <data key="d0" >
        <y:ShapeNode >
          <y:Geometry  x="241.875" y="158.701171875" width="95.0" height="30.0"/>
          <y:Fill color="#CCCCFF"  transparent="false"/>
          <y:BorderStyle type="line" width="1.0" color="#000000" />
          <y:NodeLabel x="1.5" y="5.6494140625" width="92.0" height="18.701171875" visible="true" alignment="center" fontFamily="Dialog" fontSize="12" fontStyle="plain" textColor="#000000" modelName="internal" modelPosition="c" autoSizePolicy="content">v2</y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
  </graph>
</graphml>

Expected

quoted node name in dot file should not produce duplicate quotes under graphml file.

per .dot file spec, node ID can have quotes.

An ID is one of the following:

Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_') or digits ([0-9]), not > beginning with a digit;
a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? );
any double-quoted string ("...") possibly containing escaped quotes (")1;
an HTML string (<...>).

Actual

node id has redundant quote.

<node id=""n1"">
<node id=""n2"">

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions