lib/xml-stream.js
function emitOneElement(element, name, onLeave) {
  if (typeof element === 'object') {
    emitStart.call(this, name, element.$);
    if (__own.call(element, '$children')) {
      emitChildren.call(this, element.$children);
    } else {
      var hasText = false;
      for (var child in element) {
        if (__own.call(element, child) && child !== '$' && child != '$name') {
          if (child === '$text') {
            hasText = true;
          } else {
            emitElement.call(this, element[child], child);
          }
        }
      }
      if (hasText) {
        emitText.call(this, element.$text);
      }
    }
  } else {
    emitStart.call(this, name, element.$);
    emitText.call(this, element);
  }
  if (!onLeave) {
    emitEnd.call(this, name);
  }
}
function emitOneElement(element, name, onLeave) {
  if (typeof element === 'object') {
    emitStart.call(this, name, element.$);
    if (__own.call(element, '$children')) {
      emitChildren.call(this, element.$children);
    } else {
      var hasText = false;
      for (var child in element) {
        if (__own.call(element, child) && child !== '$' && child != '$name') {
          if (child === '$text') {
            hasText = true;
          } else {
            emitElement.call(this, element[child], child);
          }
        }
      }
      if (hasText) {
        emitText.call(this, element.$text);
      }
    }
  } else {
    emitStart.call(this, name, element.$);
    emitText.call(this, element);
  }
  if (!onLeave) {
    emitEnd.call(this, name);
  }
}
function emitOneElement ( element , name , onLeave ) { if ( typeof element === 'object' ) { emitStart . call ( this , name , element . $ ) ; if ( __own . call ( element , '$children' ) ) { emitChildren . call ( this , element . $children ) ; } else { var hasText = false ; for ( var child in element ) { if ( __own . call ( element , child ) && child !== '$' && child != '$name' ) { if ( child === '$text' ) { hasText = true ; } else { emitElement . call ( this , element [ child ] , child ) ; } } } if ( hasText ) { emitText . call ( this , element . $text ) ; } } } else { emitStart . call ( this , name , element . $ ) ; emitText . call ( this , element ) ; } if ( ! onLeave ) { emitEnd . call ( this , name ) ; } }
Recursively emits a given element and its descendants.
Recursively emits a given element and its descendants .