final protected function _nodeBuilder($key, $value = null, \DOMNode &$parent = null)
	{
		if (is_null($parent)) {
			$parent = $this;
		}
		if (is_string($key)) {
			if (substr($key, 0, 1) === '@' and (is_string($value) or is_numeric($value))) {
				$parent->setAttribute(substr($key, 1), $value);
			} else {
				$node = $parent->appendChild($this->createElement($key));
				if (is_string($value)) {
					$node->appendChild($this->createTextNode($value));
				} elseif ($value instanceof \DOMNode) {
					$node->appendChild($content);
				} elseif (is_array($value) or (is_object($value) and $value = get_object_vars($value))) {
					foreach ($value as $k => $v) {
						$this->{__FUNCTION__}($k, $v, $node);
						unset($k, $v);
					}
				}
			}
		} elseif (is_string($value)) {
			$parent->appendChild($this->createTextNode($value));
		} elseif ($value instanceof \DOMNode) {
			$parent->appendChild($value);
		} elseif (is_array($value) or is_object($value) and $value = get_object_vars($value)) {
			foreach ($value as $k => $v) {
				$this->{__FUNCTION__}($k, $v, $node);
				unset($k, $v);
			}
		}
	}
final protected function _nodeBuilder($key, $value = null, \DOMNode &$parent = null)
	{
		if (is_null($parent)) {
			$parent = $this;
		}
		if (is_string($key)) {
			if (substr($key, 0, 1) === '@' and (is_string($value) or is_numeric($value))) {
				$parent->setAttribute(substr($key, 1), $value);
			} else {
				$node = $parent->appendChild($this->createElement($key));
				if (is_string($value)) {
					$node->appendChild($this->createTextNode($value));
				} elseif ($value instanceof \DOMNode) {
					$node->appendChild($content);
				} elseif (is_array($value) or (is_object($value) and $value = get_object_vars($value))) {
					foreach ($value as $k => $v) {
						$this->{__FUNCTION__}($k, $v, $node);
						unset($k, $v);
					}
				}
			}
		} elseif (is_string($value)) {
			$parent->appendChild($this->createTextNode($value));
		} elseif ($value instanceof \DOMNode) {
			$parent->appendChild($value);
		} elseif (is_array($value) or is_object($value) and $value = get_object_vars($value)) {
			foreach ($value as $k => $v) {
				$this->{__FUNCTION__}($k, $v, $node);
				unset($k, $v);
			}
		}
	}
final protected function _nodeBuilder ( $ key , $ value = null , \ DOMNode & $ parent = null ) { if ( is_null ( $ parent ) ) { $ parent = $ this ; } if ( is_string ( $ key ) ) { if ( substr ( $ key , 0 , 1 ) === '@' and ( is_string ( $ value ) or is_numeric ( $ value ) ) ) { $ parent -> setAttribute ( substr ( $ key , 1 ) , $ value ) ; } else { $ node = $ parent -> appendChild ( $ this -> createElement ( $ key ) ) ; if ( is_string ( $ value ) ) { $ node -> appendChild ( $ this -> createTextNode ( $ value ) ) ; } elseif ( $ value instanceof \ DOMNode ) { $ node -> appendChild ( $ content ) ; } elseif ( is_array ( $ value ) or ( is_object ( $ value ) and $ value = get_object_vars ( $ value ) ) ) { foreach ( $ value as $ k => $ v ) { $ this -> { __FUNCTION__ } ( $ k , $ v , $ node ) ; unset ( $ k , $ v ) ; } } } } elseif ( is_string ( $ value ) ) { $ parent -> appendChild ( $ this -> createTextNode ( $ value ) ) ; } elseif ( $ value instanceof \ DOMNode ) { $ parent -> appendChild ( $ value ) ; } elseif ( is_array ( $ value ) or is_object ( $ value ) and $ value = get_object_vars ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ this -> { __FUNCTION__ } ( $ k , $ v , $ node ) ; unset ( $ k , $ v ) ; } } }
Dynamically and seemingly magically build nodes and append to parent

@param mixed    $key    Int or string to become tagname of new node
@param mixed    $value  String, array, sdtClass object, DOMNode
@param \DOMNode $parent Parent element to append to (defaults to $this)
@return void
Dynamically and seemingly magically build nodes and append to parent