private function makeNode($tagName, $tagContent, array $attributes = null, $omitEndTag = false)
    {
        $nodeText = '';
        $attrText = '';

        if ($attributes != null) {
            foreach ($attributes as $key => $value) {
                $value = self::filterInvalidXMLChars($value);
                $value = htmlspecialchars($value);
                $attrText .= " $key=\"$value\"";
            }
        }

        $attrText .= (in_array($tagName, $this->CDATAEncoding) && $this->version == Feed::ATOM) ? ' type="html"' : '';
        $nodeText .= "<{$tagName}{$attrText}>";
        $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? '<![CDATA[' : '';

        if (is_array($tagContent)) {
            foreach ($tagContent as $key => $value) {
                if (is_array($value)) {
                    $nodeText .= PHP_EOL;
                    foreach ($value as $subValue) {
                        $nodeText .= $this->makeNode($key, $subValue);
                    }
                } else if (is_string($value)) {
                    $nodeText .= $this->makeNode($key, $value);
                } else {
                    throw new \InvalidArgumentException("Unknown node-value type for $key");
                }
            }
        } else {
            $tagContent = self::filterInvalidXMLChars($tagContent);
            $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? $this->sanitizeCDATA($tagContent) : htmlspecialchars($tagContent);
        }

        $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? ']]>' : '';

        if (!$omitEndTag)
            $nodeText .= "</$tagName>";

        $nodeText .= PHP_EOL;

        return $nodeText;
    }
private function makeNode($tagName, $tagContent, array $attributes = null, $omitEndTag = false)
    {
        $nodeText = '';
        $attrText = '';

        if ($attributes != null) {
            foreach ($attributes as $key => $value) {
                $value = self::filterInvalidXMLChars($value);
                $value = htmlspecialchars($value);
                $attrText .= " $key=\"$value\"";
            }
        }

        $attrText .= (in_array($tagName, $this->CDATAEncoding) && $this->version == Feed::ATOM) ? ' type="html"' : '';
        $nodeText .= "<{$tagName}{$attrText}>";
        $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? '<![CDATA[' : '';

        if (is_array($tagContent)) {
            foreach ($tagContent as $key => $value) {
                if (is_array($value)) {
                    $nodeText .= PHP_EOL;
                    foreach ($value as $subValue) {
                        $nodeText .= $this->makeNode($key, $subValue);
                    }
                } else if (is_string($value)) {
                    $nodeText .= $this->makeNode($key, $value);
                } else {
                    throw new \InvalidArgumentException("Unknown node-value type for $key");
                }
            }
        } else {
            $tagContent = self::filterInvalidXMLChars($tagContent);
            $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? $this->sanitizeCDATA($tagContent) : htmlspecialchars($tagContent);
        }

        $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? ']]>' : '';

        if (!$omitEndTag)
            $nodeText .= "</$tagName>";

        $nodeText .= PHP_EOL;

        return $nodeText;
    }
private function makeNode ( $ tagName , $ tagContent , array $ attributes = null , $ omitEndTag = false ) { $ nodeText = '' ; $ attrText = '' ; if ( $ attributes != null ) { foreach ( $ attributes as $ key => $ value ) { $ value = self :: filterInvalidXMLChars ( $ value ) ; $ value = htmlspecialchars ( $ value ) ; $ attrText .= " $key=\"$value\"" ; } } $ attrText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) && $ this -> version == Feed :: ATOM ) ? ' type="html"' : '' ; $ nodeText .= "<{$tagName}{$attrText}>" ; $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? '<![CDATA[' : '' ; if ( is_array ( $ tagContent ) ) { foreach ( $ tagContent as $ key => $ value ) { if ( is_array ( $ value ) ) { $ nodeText .= PHP_EOL ; foreach ( $ value as $ subValue ) { $ nodeText .= $ this -> makeNode ( $ key , $ subValue ) ; } } else if ( is_string ( $ value ) ) { $ nodeText .= $ this -> makeNode ( $ key , $ value ) ; } else { throw new \ InvalidArgumentException ( "Unknown node-value type for $key" ) ; } } } else { $ tagContent = self :: filterInvalidXMLChars ( $ tagContent ) ; $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? $ this -> sanitizeCDATA ( $ tagContent ) : htmlspecialchars ( $ tagContent ) ; } $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? ']]>' : '' ; if ( ! $ omitEndTag ) $ nodeText .= "</$tagName>" ; $ nodeText .= PHP_EOL ; return $ nodeText ; }
Creates a single node in XML format

@access   private
@param    string $tagName    name of the tag
@param    mixed  $tagContent tag value as string or array of nested tags in 'tagName' => 'tagValue' format
@param    array  $attributes Attributes (if any) in 'attrName' => 'attrValue' format
@param    bool $omitEndTag True if the end tag should be omitted. Defaults to false.
@return   string  formatted xml tag
@throws   \InvalidArgumentException if the tagContent is not an array and not a string.
Creates a single node in XML format