Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (64 sloc) 2.22 KB
use strict;
use Test::More;
unless (eval { require XML::XPath }) {
plan skip_all => 'XML::XPath required for this test';
plan tests => 4;
## hardcore, because XML::Atom doesn't make it easy to change it at
## runtime
require XML::Atom;
if (XML::Atom->LIBXML) {
no strict 'refs';
diag "XPath Override in place";
*{XML::Atom::LIBXML} = sub() {0};
use XML::Parser;
use XML::Atom::Entry;
use FindBin;
my $filepath = "$FindBin::Bin/samples/entry-ns.xml";
my $xml = <<"EOX";
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE entry [
<!ENTITY ref SYSTEM "file://$filepath">
<entry xmlns="" xmlns:dc="">
<title>Guest Author</title>
<link rel="alternate" type="text/html" href="" />
<link rel="service.edit" title="Edit" type="application/x.atom+xml" href="" />
<summary>No, Ben isn&apos;t updating. It&apos;s me testing out guest author functionality....</summary>
<content type="text/html" xml:lang="en-us">&ref;
<div xmlns=""><p>No, Ben isn't updating. It's me testing out guest author functionality.</p></div>
## Sane default
my $entry = XML::Atom::Entry->new(Stream => \$xml);
is $entry->title, "Guest Author", "got title";
my $content = $entry->content->body;
unlike $content, qr/This is what you get when you do unit testing/,
"ignored entity";
## custom parser
my $parser = XML::Parser->new(); # no option
my $entry = XML::Atom::Entry->new(Stream => \$xml, Parser => $parser);
is $entry->title, "Guest Author", "got title";
my $content = $entry->content->body;
like $content, qr/This is what you get when you do unit testing/,
"resolved entity";
Something went wrong with that request. Please try again.