Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in parsing the graph for xml conversion with fdp #68

Open
pandey0039 opened this issue May 23, 2024 · 1 comment
Open

Error in parsing the graph for xml conversion with fdp #68

pandey0039 opened this issue May 23, 2024 · 1 comment

Comments

@pandey0039
Copy link

Hi Everyone,
I made the graph with pydot library using "fdp" layout parameter and also giving position for each nodes for the graph. While converting the graph to xml, it is giving error as :

Traceback (most recent call last):

  File ~\AppData\Local\anaconda\Lib\site-packages\IPython\core\interactiveshell.py:3505 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[160], line 3
    xml = graphviz2drawio.convert(gdt)

  File ~\AppData\Local\anaconda\Lib\site-packages\graphviz2drawio\graphviz2drawio.py:26 in convert
    nodes, edges = SvgParser(svg_graph).get_nodes_and_edges()

  File ~\AppData\Local\anaconda\Lib\site-packages\graphviz2drawio\models\SvgParser.py:14 in get_nodes_and_edges
    root = ElementTree.fromstring(self.svg_data)[0]

  File ~\AppData\Local\anaconda\Lib\xml\etree\ElementTree.py:1338 in XML
    parser.feed(text)

  File <string>
ParseError: not well-formed (invalid token): line 64, column 109

Some relevant code info is as follows which I find was different than usual standard code:

# Create an empty PyDot graph
G_pydot = pydot.Dot(graph_type='digraph',layout="fdp")

pydot_node = pydot.Node(str(node), label=item['text'],shape=get_shape(item['shape_type']),slane=key,pos=f"{X},{Y}!") 

# Add the PyDot node to the PyDot graph
G_pydot.add_node(pydot_node)`

gdt=G_pydot.to_string()
xml = graphviz2drawio.convert(gdt)
@hbmartin hbmartin added this to the 0.4 milestone Jul 2, 2024
@hbmartin hbmartin changed the title Error in parsing the graph for xml conversion Error in parsing the graph for xml conversion with fdp Jul 3, 2024
@hbmartin
Copy link
Owner

hbmartin commented Jul 6, 2024

I'm not familiar with PyDot, can you post the result of G_pydot.to_string() ?

@hbmartin hbmartin removed this from the 0.4 milestone Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants