mo4islona / node-blockly

Blockly for Node.js and Browser via CommonJS module
133 stars 81 forks source link

TypeError: Cannot read property '0' of undefined #15

Closed Immortalin closed 6 years ago

Immortalin commented 6 years ago

I am getting an error with the following code:

<xml xmlns="http://www.w3.org/1999/xhtml">
  <variables></variables>
  <block type="controls_repeat_ext" id="(BFo|WQ,-6A?iUwjWMq*" x="238" y="63">
    <value name="TIMES">
      <shadow type="math_number" id="QU(s4?wLG]]%mQZ:pPQP">
        <field name="NUM">10</field>
      </shadow>
    </value>
  </block>
</xml>

Most of the XML generated by this doesn't seem to work with node-blockly (tested the XML against the in-browser generator, XML is valid).

mo4islona commented 6 years ago

Seems, Blockly uses DOM4 API props like Element.children. But nodejs replacement for xmldom doesn`t support it. Will try to fix that.

Thx!

Immortalin commented 6 years ago

@mo4islona maybe use http://webreflection.github.io/dom4/ or jsdom?

Immortalin commented 6 years ago

Or for even faster speed: https://github.com/libxmljs/libxmljs

Immortalin commented 6 years ago

@mo4islona any luck?