ERROR TypeError: Cannot read property 'isConnected' of null while using Blockly.Xml.domToWorkspace()

550 views
Skip to first unread message

Khushbu Yeole

unread,
Jul 3, 2018, 6:01:11 AM7/3/18
to Blockly
Hi,

I have my Xml is:
<?xml version="1.0" encoding="UTF-8"?>
   <block type="khushi123:Event:ultrasonic_D6_changed" id="iPme*c;v@l7G5UAsD[=?" x="243" y="57">
      <next>
         <block type="controls_if" id="AItA7cnY)LQP%nD$dTgI">
            <value name="IF0">
               <block type="logic_compare" id="sp2d4S%z6!MwbqTt`wKC">
                  <field name="OP">LT</field>
                  <value name="A">
                     <block type="khushi123:Get_Data:ultrasonic_D6" id="X1S9{s)~EM@IksF8.#om" />
                  </value>
                  <value name="B">
                     <block type="math_number" id="oxdM4:Sricpt#MDVDI89">
                        <field name="NUM">11</field>
                     </block>
                  </value>
               </block>
            </value>
            <statement name="DO0">
               <block type="khushi123:Set_Data:buzzer_D2" id="^{_r9[#;UJ0oT5Af}%q5">
                  <value name="buzzer_D2">
                     <block type="logic_boolean" id="iZ5uBfuoK@=DB~!]8Za|">
                        <field name="BOOL">TRUE</field>
                     </block>
                  </value>
                  <next>
                     <block type="khushi321:Set_Data:relay_D2" id="SI(L!r]8wz^hG;}Uj?hq">
                        <value name="relay_D2">
                           <block type="logic_boolean" id="V(5_];B|U#pbWHZ]%wye">
                              <field name="BOOL">FALSE</field>
                           </block>
                        </value>
                        <next>
                           <block type="khushi123:Set_Data:led_D4" id="_D6e~(a)Q7)LSnHwl;4L">
                              <value name="led_D4">
                                 <block type="logic_boolean" id=";^SC6UDln*S#08BqXn3u">
                                    <field name="BOOL">TRUE</field>
                                 </block>
                              </value>
                              <next>
                                 <block type="khushi321:Set_Data:led_D3" id="Nb7jy)JogG(2`]o+Fp@2">
                                    <value name="led_D3">
                                       <block type="logic_boolean" id="q9H`o!rs.jWS2Mk/Uv?~">
                                          <field name="BOOL">FALSE</field>
                                       </block>
                                    </value>
                                 </block>
                              </next>
                           </block>
                        </next>
                     </block>
                  </next>
               </block>
            </statement>
         </block>
      </next>
   </block>
</xml>

And am using 

let xml = Blockly.Xml.textToDom(workspaceXml);
Blockly.Xml.domToWorkspace(xml, Blockly.mainWorkspace);
also tried with excahnging parameters of Blockly.Xml.domToWorkspace

but still getting error ERROR TypeError: Cannot read property 'isConnected' of null

Please help me i am missing something.

Erik Pasternak

unread,
Jul 3, 2018, 2:59:22 PM7/3/18
to Blockly
Hi Khushbu,

That probably means one of the connections in your xml doesn't actually exist on the block, so when Blockly tries to get the connection it fails. It could be a missing next, previous, or output connection on a block or one of the value/statement inputs has a typo in the name. You might try loading just a few blocks at a time to figure out which block has the issue and then double check the block's connections match the ones in the xml.

Did you generate this xml from blocks or did you write some of it by hand?

Cheers,
Erik

Khushbu Yeole

unread,
Jul 4, 2018, 5:24:43 AM7/4/18
to Blockly
It works for me 
Thanks.
Reply all
Reply to author
Forward
0 new messages