dom to workspace does not work?

70 views
Skip to first unread message

LarsiSpasi

unread,
Sep 14, 2023, 1:04:27 PM9/14/23
to Blockly
So, after trying json serialization, i decided for html.
Blockly.Xml.domToWorkspace(workspace, xml);
yet it gives: Uncaught TypeError: Cannot read properties of undefined (reading '0')
    at $.domToWorkspace$$module$build$src$core$xml [as domToWorkspace] (math.js:273:68)

code: 
              var xmlDome = Blockly.utils.xml.textToDom(xmlTexte);
              Blockly.Xml.domToWorkspace(workspace, xmlDome);
Screenshot 2023-09-14 190356.png

Beka Westberg

unread,
Sep 14, 2023, 6:46:30 PM9/14/23
to blo...@googlegroups.com
Hello!

You need to swap the order of your arguments to `domToWorkspace`. It should be:

```
Blockly.Xml.domToWorkspace(xmlDome, workspace);
```

I hope that helps =) If you have any further questions please reply!
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/3bf36c4e-cca7-43ad-ba3e-e9a4a7c7398an%40googlegroups.com.

LarsiSpasi

unread,
Sep 15, 2023, 4:41:57 AM9/15/23
to Blockly
I can't believe i made such a simple mistake... Thanks a lot!
Reply all
Reply to author
Forward
0 new messages