Skip to content

mxCodec.decode used not work  #58

@jakim9913

Description

@jakim9913

hello.
I am trying to draw a graph on canvas by importing the created xml.

However, the MxCodec.decode function does not work.
The graph is not rendered or drawn.

origin code

     const xmlDoc = MxUtils.parseXml(data);
            const codec = new MxCodec(xmlDoc);
            codec.decode(xmlDoc.documentElement, this.graph.getModel());

but, Code I found on the internet

let elt = xmlDoc.documentElement.firstChild;
            let cells = [];
            while (elt != null) {
                cells.push(codec.decode(elt));
                this.graph.refresh();
                elt = elt.nextSibling;
            }
            this.graph.addCells(cells);

Both don't work.

Please tell me how to render the xml.
thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions