My next project in the “whittling wood”? Figuring out why XML::RSS::LibXML parses these tags without any problem:
<itunes:category text="News & Politics"/> <itunes:image href="http://media.npr.org/images/podcasts/2013/primary/hourly_news_summary-c464279737c989a5fbf3049bc229152af3c36b9d.png?s=1400"/>
and produces this internal data structure:
category => bless( { _attributes => [ "text" ], _content => "", text => "News & Politics" }, 'XML::RSS::LibXML::MagicElement' ), image => bless( { _attributes => [ "href" ], _content => "", href => "http://media.npr.org/images/podcasts/2013/primary/hourly_news_summary-c464279737c989a5fbf3049bc229152af3c36b9d.png?s=1400" }, 'XML::RSS::LibXML::MagicElement' ),
But then doesn’t have these tags anywhere in the re-rendered XML when it spits it back out again. I know it has to do with the fact that these tags have no content (there’s no opening and closing tag, there’s just the one tag closed with a />), but I don’t know why XML::RSS isn’t properly rendering it when it converts the data structure back to XML.
The easy work-around would be to just do some string matching, recognize these tags in the original XML, copy them and re-insert them into the rendered XML afterwards.
The more difficult fix is to figure out what’s wrong with XML::RSS and try to fix it myself.
Guess which road I’m taking?