title: How to count children of xml element?
body: <p>I know this has been asked before, but I'm kinda lost here.</p>
  
  <p>I've got an element from which I log the typeof:</p>
  
  <pre><code>typeof msg['PID']['PID.13']  // outputs "xml"
  </code></pre>
  
  <p>So following <a href="https://stackoverflow.com/a/11776835/1650012">this answer</a> I logged the <code>children.length</code>, of which I expect it to be a number:</p>
  
  <pre><code>typeof msg['PID']['PID.13'].children.length  // also outputs "xml"
  </code></pre>
  
  <p>But the typeof the <code>children.length</code> is also <code>xml</code>. How can this be?</p>
  
  <p>It's Javascript hidden in a system (Mirth) in which logging is a problem (at least I still haven't found out how it works) so I'm having a hard time debugging this.</p>
  
  <p>Does anybody know how I can get the children count of the element? All tips are welcome!</p>
  
  <p>[EDIT]
  As suggested I also tried the output of <code>msg['PID']['PID.13'].children.length</code>, but that seems to be empty.</p>