XML::SAX::Writer::start_cdata - bug or am I just stupid?
by Aaron Straup Cope other posts by this author
Oct 4 2002 11:56AM messages near this date
view in the new Beta List Site
Re: XML::SAX::Writer - $self->{InCDATA}
|
Where to download LibXML and LibXSLT modules?
Hi all,
So, the other day I wrote a quick and dirty SAX2 filter for Iain
Truskett's WWW::Yahoo::Groups module.
The filter parses the RSS file that is returned for a Yahoo group uses the
WWW:: module to fetch the full body of each message and squirt it into the
output file wrapped in the mod_content encoded element. [1]
I mentioned the package to Iain who promptly linked to it, in version 1.6,
as though it were on the CPAN. So now I feel compelled to take what was a
pretty haphazard job and clean it up before pushing it on the workd for
real (oh, the mistakes - they hurt!)
One of the problems is that the body of the content:encoded element needs
to be wrapped in <![CDATA[ ]]> tags per the mod_content spec. Not a
problem, per se, except that XML::SAX::Writer 0.44 only seems to want to
print the CDATA tags and then the message body.
Or I'm an idiot and completely spaced out on how this supposed to work.
I've got the following chunk of code, which by all appearances should DWIM
:
$self-> SUPER::start_prefix_mapping({Prefix=>"content",NamespaceURI=>CONTENT});
$self-> SUPER::start_element({Name=>"content:encoded"});
$self-> SUPER::start_cdata();
$self-> SUPER::characters({Data=>$self->_fetch_message($msg)});
$self-> SUPER::end_cdata();
$self-> SUPER::end_element({Name=>"content:encoded"});
$self-> SUPER::end_prefix_mapping({Prefix=>"dc"});
But which returns...
<title> fcrand27</title>
<link> http://groups.yahoo.com/group/weblog-devel/message/244</link>
<description> Some help needed please</description>
<content:encoded
xmlns:content='http://purl.org/rss/1.0/modules/content/'> <![CDATA[]]>From
fcrand27@y.
Ack!
Is this a bug or can someone point out what I'm doing wrong (gently,
please :-) ?
Thanks,
Version 0.1 is over here...
http://perl.aaronland.info/xml-filter/yahoo-groups/
...but please note that it does contain some pretty silly bugs,
particularly the use of the non-existent dc:content element (ack!)
[1] http://diveintomark.org/archives/2002/09/05.html#rss_20
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
|