title: Extracting data from XML returning a node removal error
body: <p>I have an XML output for my API call that contains the following:</p>
  
  <pre><code> &lt;channel channel="194882" name="Main Power Main Panel"&gt;
   &lt;kWh&gt;0.319&lt;/kWh&gt; 
   &lt;/channel&gt;
  </code></pre>
  
  <p>And I am trying to create a table with the <code>name</code> and <code>kWh</code>.  So, I just need it to output, <code>Main Power Main Panel 0.319</code> in my table.  </p>
  
  <p>I am receiving an error that <code>Failed to execute "removeChild" on "Node": The node to be removed is not a child of this node.</code>  I think the issue is that I have a <code>name=</code> element and not <code>&lt;name&gt;...&lt;/name&gt;</code> element type, but I'm not sure how to circumvent this.</p>
  
  <p>My DOM function looks like the following:</p>
  
  <pre><code>   getDom: function(){
          var wrapper = document.createElement("div");
          if(!this.loaded) {
                  wrapper.innerHTML = "Loading...";
                  return wrapper;
          }
          if(this.xml !== null){
           var table = document.createElement("table");
           table.classList.add("xsmall", "table");
           var channels = this.xml.getElementsByTagName("channel");
           for(var i = 0; i &lt; channels.length; i++){
             var row = document.createElement("tr");
             for(var n = 0; n &lt; channels[i].children.length; n++){
                  if(channels[i].children[n].tagName === "name" || channels[i].children[n].tagName === "kWh"){
  
                  var element = document.createElement("td");
                  element.classList.add(channels[i].children[n].tagName);
                  if (channels[i].children[n].textContent != 0){
              element.innerHTML = channels[i].children[n].textContent;
              row.appendChild(element);
              table.appendChild(row);
              }      
          else {
              table.removeChild(row); }
          }
  
  
             }
           }
           wrapper.appendChild(table);
          } else {
                  console.log("Returned no Data");
                  wrapper.innerHTML = "NO DATA";
          }
          return wrapper;
     },
  </code></pre>
  
  <p>This is for the magic mirror project, for those familiar.  Thanks for looking and for your help!</p>