Return a DOMElement instead of a string in Tweeper::generateEnclosure()
authorAntonio Ospite <ao2@ao2.it>
Wed, 18 May 2016 20:32:06 +0000 (22:32 +0200)
committerAntonio Ospite <ao2@ao2.it>
Fri, 20 May 2016 13:03:13 +0000 (15:03 +0200)
This make the generated XML have proper indentation in case the
<enclosure/> element gets added.

rss_converter_instagram.com.xsl
rss_converter_twitter.com.xsl
tweeper.php

index 5a64a57..f12ecbb 100644 (file)
@@ -33,7 +33,7 @@
     </xsl:variable>
 
     <xsl:template match="display_src">
     </xsl:variable>
 
     <xsl:template match="display_src">
-        <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generateEnclosure', string(text()))"/>
+        <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(text()))"/>
     </xsl:template>
 
     <xsl:variable name="user-name" select="//ProfilePage/user/username"/>
     </xsl:template>
 
     <xsl:variable name="user-name" select="//ProfilePage/user/username"/>
index 0701d5c..6ef86dd 100644 (file)
@@ -33,7 +33,7 @@
     </xsl:variable>
 
     <xsl:template match="a[@data-expanded-url]">
     </xsl:variable>
 
     <xsl:template match="a[@data-expanded-url]">
-        <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/>
+        <xsl:copy-of select="php:function('Tweeper::generateEnclosure', string(./@data-expanded-url))"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
     </xsl:template>
 
     <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
index d84094e..579aae1 100644 (file)
@@ -156,9 +156,7 @@ class Tweeper {
     $enc->setAttribute('length', $url_info['download_content_length']);
     $enc->setAttribute('type', $url_info['content_type']);
 
     $enc->setAttribute('length', $url_info['download_content_length']);
     $enc->setAttribute('type', $url_info['content_type']);
 
-    $dom->appendChild($enc);
-
-    return $dom->saveXML($enc);
+    return $enc;
   }
 
   /**
   }
 
   /**