Subject: | as_xml() function do not appear to include the URL in bookmark entries |
Distibution: Bookmarks-Parser-0.01
perl version: 5.8.5
OS/version: Linux - 2.6.8.1-12mdk
Sample code:
#!/usr/bin/perl -w
use strict;
use Bookmarks::Parser;
$| = 1;
my $bm_file = q{source.20060423.01.html};
my $outfile = q{test.20060423.01.html};
my $parser = Bookmarks::Parser->new();
my $combined_bookmarks = $parser->parse( { filename => $bm_file } );
open OUTF, q{>} . $outfile or die $!;
binmode OUTF, q{:utf8};
$combined_bookmarks->as_xml();
print OUTF $combined_bookmarks->as_xml()->as_string();
close OUTF;
Expected results:
Based on the sample data (source.200760423.01.html), that the URL
"http://www.perlmonks.org/index.pl?node_id=72241" would appear somewhere
in the output file (test.200760423.01.html).
Actual results:
$ cat test.20060423.01.html
<?xml version="1.0" encoding="UTF-8"?>
<!--
Bookmarks::XML internal format
Created on: Sun Apr 23 14:31:08 2006
-->
<bookmarks title="Bookmarks">
<bookmark id="rdf:#$AbGa5" name="What XML generators are currently
available on PerlMonks?" created="1041694535" visited="1140911112"
modified="0" icon="http://www.perlmonks.org/favicon.ico" description=""
order="" />
</bookmarks>
$ cat source.20060423.01.html
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><A HREF="http://www.perlmonks.org/index.pl?node_id=72241"
ADD_DATE="1041694535" LAST_VISIT="1140911112"
ICON="http://www.perlmonks.org/favicon.ico" LAST_CHARSET="ISO-8859-1"
ID="rdf:#$AbGa5">What XML generators are currently available on
PerlMonks?</A>
</DL><p>
Possible reason for issue:
In the code for Bookmarks::XML, the line in get_item_as_string function
(used by the Bookmarks::Parser::as_string function) when handling a
bookmark itself appears to be missing the URL field. Observe,
elsif($item->{type} eq 'url')
{
$string .= << "XML";
<bookmark id="$id" name="$name" created="$created"
visited="$visited" modified="$modified" icon="$icon" description="$desc"
order="$order" />
XML
}