Giter VIP home page Giter VIP logo

xml-atom's Introduction

NAME

XML::Atom - Atom feed and API implementation

SYNOPSIS

use XML::Atom;

DESCRIPTION

Atom is a syndication, API, and archiving format for weblogs and other data. XML::Atom implements the feed format as well as a client for the API.

LICENSE

XML::Atom is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Benjamin Trott, Tatsuhiko Miyagawa

COPYRIGHT

All rights reserved.

xml-atom's People

Contributors

miyagawa avatar apparentlymart avatar bobtfish avatar wchristian avatar davorg avatar fschlich avatar veselosky avatar yannk avatar omega avatar dsteinbrunner avatar leto avatar emasaka avatar tokuhirom avatar tzccinct avatar

Stargazers

thezakalmanak avatar Thibault Duponchelle avatar Harsha avatar Angus H. avatar Mathieu MARCHANDISE avatar Thorsten Schwander avatar Michael Alan Dorman avatar  avatar Dmitri Popov avatar Benjamin Trott avatar Mizar / みざー avatar  avatar Alex White avatar  avatar Naveed Massjouni avatar Alex Kapranoff avatar David E. Wheeler avatar  avatar  avatar Jay Allen avatar  avatar Simon Wistow avatar Sterling Hanenkamp avatar  avatar Nobuo Danjou avatar  avatar Jun Kaneko avatar  avatar Peter Keane avatar  avatar

Watchers

 avatar Simon Wistow avatar James Cloos avatar  avatar  avatar

xml-atom's Issues

Cannot extract href etc. if namespace is redundantly specified

The atom feed at http://what-if.xkcd.com/feed.atom specifies the namespace for every attribute, i.e. it looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <entry>
    <id>https://what-if.xkcd.com/157/</id>
    <title xmlns:ns="http://www.w3.org/2005/Atom" ns:type="text">Earth-Moon Fire Pole</title>
    <link xmlns:ns="http://www.w3.org/2005/Atom" ns:href="https://what-if.xkcd.com/157/" ns:rel="alternate" ns:type="text/html"/>
  </entry>
</feed>

This is AFAIK redundant, but allowed.

But XML::Atom (or maybe the underlying XML library) seems to treat a bare href on the <link/> element (which ought to inherit the namespace from the <feed> element and ns:href (which gets the same namespace from the namespace declaration on the <link> element) differently. Hence ->href() returns undef instead of "https://what-if.xkcd.com/157/".

As a workaround, calling $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'href') returns the correct result, but I think XML::Atom (or the underlying XML library) should handle this case.

Fails test when no '.' in @INC

On 5.26.0-RC1 , where '.' is not in @inc by default:

Can't locate t/TestLib.pm in @INC (you may need to install the t::TestLib module) (@INC contains: 
/builddir/build/BUILD/XML-Atom-0.42/blib/arch /builddir/build/BUILD/XML-Atom-0.42/blib/lib /usr/local/lib64/perl5 
/usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 
/usr/share/perl5) at t/11-entry.t line 5.
BEGIN failed--compilation aborted at t/11-entry.t line 5.
t/11-entry.t ..................... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 

cpanfile does not have test dependencies

It should contain at least

on test => sub {
    requires 'Test::More';
};

Otherwise installing it on a fresh Debian install via cpanm fails if done without --notest.

t/18-unicode.t fails due to using depracated pragma 'encoding'

On 5.26.0-RC1, test t/18-unicode.t fails with following error:

The encoding pragma is no longer supported at t/18-unicode.t line 4.
BEGIN failed--compilation aborted at t/18-unicode.t line 4.
t/18-unicode.t ...................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run

Failing Tests

Even after applying #14 , the following is the ouput of ./Build test

t/00-compile.t ................... ok
t/01-util.t ...................... ok
t/02-content.t ................... ok
t/03-link.t ...................... ok
t/04-person.t .................... ok

#   Failed test at t/11-entry.t line 98.
#          got: undef
#     expected: 'Food & Drink'

#   Failed test at t/11-entry.t line 106.
#          got: undef
#     expected: 'Food & Drink'

#   Failed test at t/11-entry.t line 151.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <entry xmlns="http://purl.org/atom/ns#"><content xmlns="http://purl.org/atom/ns#" mode="base64" type="image/gif">VGhpcyBpcyBhIHRlc3QgdGhhdCBzaG91bGQgdXNlIGJhc2U2NAAu</content><link xmlns="http://purl.org/atom/ns#" xmlns:list="http://www.sixapart.com/atom/list#" title="Number Three" rel="service.post" href="http://www.example.com/atom" type="application/x.atom+xml" list:type="Books" /><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Weblog</subject></entry>'
#     doesn't match '(?^:<dc:subject .*>Weblog</dc:subject>)'

#   Failed test at t/11-entry.t line 154.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <entry xmlns="http://purl.org/atom/ns#"><content xmlns="http://purl.org/atom/ns#" mode="base64" type="image/gif">VGhpcyBpcyBhIHRlc3QgdGhhdCBzaG91bGQgdXNlIGJhc2U2NAAu</content><link xmlns="http://purl.org/atom/ns#" xmlns:list="http://www.sixapart.com/atom/list#" title="Number Three" rel="service.post" href="http://www.example.com/atom" type="application/x.atom+xml" list:type="Books" /><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Weblog</subject><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Tech</subject></entry>'
#     doesn't match '(?^:<dc:subject .*>Weblog</dc:subject>)'

#   Failed test at t/11-entry.t line 155.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <entry xmlns="http://purl.org/atom/ns#"><content xmlns="http://purl.org/atom/ns#" mode="base64" type="image/gif">VGhpcyBpcyBhIHRlc3QgdGhhdCBzaG91bGQgdXNlIGJhc2U2NAAu</content><link xmlns="http://purl.org/atom/ns#" xmlns:list="http://www.sixapart.com/atom/list#" title="Number Three" rel="service.post" href="http://www.example.com/atom" type="application/x.atom+xml" list:type="Books" /><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Weblog</subject><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Tech</subject></entry>'
#     doesn't match '(?^:<dc:subject .*>Tech</dc:subject>)'

#   Failed test at t/11-entry.t line 159.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <entry xmlns="http://purl.org/atom/ns#"><content xmlns="http://purl.org/atom/ns#" mode="base64" type="image/gif">VGhpcyBpcyBhIHRlc3QgdGhhdCBzaG91bGQgdXNlIGJhc2U2NAAu</content><link xmlns="http://purl.org/atom/ns#" xmlns:list="http://www.sixapart.com/atom/list#" title="Number Three" rel="service.post" href="http://www.example.com/atom" type="application/x.atom+xml" list:type="Books" /><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Weblog</subject><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Tech</subject><subject xmlns:dc="http://purl.org/dc/elements/1.1/">Weblog</subject></entry>'
#     doesn't match '(?^:<dc:subject .*>Weblog</dc:subject>)'
# Looks like you failed 6 tests of 71.
t/11-entry.t .....................
Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/71 subtests
	(less 2 skipped subtests: 63 okay)
Can't call method "get_global_pos" on an undefined value at /home/yigit/perl5/lib/perl5/XML/XPath/Node.pm line 412.
# Looks like your test exited with 255 just after 29.
t/12-feed.t ......................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 4/33 subtests

#   Failed test 'atom:title'
#   at t/13-atom1.t line 13.
#          got: undef
#     expected: 'dive into mark'

#   Failed test 'atom:version based on namespace'
#   at t/13-atom1.t line 14.
#          got: '0.3'
#     expected: '1.0'

#   Failed test 'atom:updated'
#   at t/13-atom1.t line 15.
#          got: undef
#     expected: '2005-07-11T12:29:29Z'

#   Failed test '2 links'
#   at t/13-atom1.t line 18.
#          got: '0'
#     expected: '2'
Can't call method "hreflang" on an undefined value at t/13-atom1.t line 53.
# Looks like your test exited with 255 just after 5.
t/13-atom1.t .....................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/23 subtests
t/14-atom1-create.t .............. ok
t/15-content-image.t ............. ok
t/16-content-binary.t ............ ok
Can't call method "modified" on an undefined value at t/17-renames.t line 11.
# Looks like your test exited with 255 just after 1.
t/17-renames.t ...................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 4/5 subtests
t/18-unicode.t ................... skipped: Skipping Unicode test since it depends on LibXML

#   Failed test at t/19-ext.t line 35.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <with_ns xmlns="XML::Atom::Namespace=HASH(0x56212ee14960)" baz="1" />'
#     doesn't match '(?^:<withns:with_ns.+xmlns:withns="http://example.com/withns/")'

#   Failed test at t/19-ext.t line 38.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <feed xmlns="http://purl.org/atom/ns#"><foo xmlns="http://www.example.com/ns/"><bar xmlns="http://www.example.com/ns/">1</bar></foo><foo2 xmlns="http://www.example.com/ns/"><bar xmlns="http://www.example.com/ns/">1</bar></foo2><with_ns xmlns="XML::Atom::Namespace=HASH(0x56212ee14960)" baz="1" /></feed>'
#     doesn't match '(?^:<withns:with_ns.+xmlns:withns="http://example.com/withns/")'
# Looks like you failed 2 tests of 16.
t/19-ext.t .......................
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/16 subtests
t/20-content-xhtml.t ............. ok
t/21-client.t .................... skipped: Don't do live Atom test
t/22-autodiscovery.t ............. skipped: http://diveintomark.org/tests/client/autodiscovery/: 200 OK

#   Failed test at t/23-category.t line 9.
Can't call method "title" on an undefined value at t/23-category.t line 10.
# Looks like your test exited with 255 just after 1.
t/23-category.t ..................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/1 subtests
t/24-bad-content.t ............... ok

#   Failed test at t/25-utf8-create.t line 17.
#          got: undef
#     expected: 'Dicionários'
# Looks like you failed 1 test of 2.
t/25-utf8-create.t ...............
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/27-client-leaks.t .............. ok

#   Failed test 'extension accessors'
#   at t/28-ext.t line 61.
#          got: undef
#     expected: '2'

#   Failed test 'extension accessors'
#   at t/28-ext.t line 61.
#          got: undef
#     expected: '2'

#   Failed test 'extension accessors'
#   at t/28-ext.t line 61.
#          got: undef
#     expected: '2'

#   Failed test 'ext link match'
#   at t/28-ext.t line 66.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <feed xmlns="http://purl.org/atom/ns#"><link xmlns="http://purl.org/atom/ns#" href="http://www.legacy_link.com" /><link xmlns="XML::Atom::Namespace=HASH(0x55ef340ce6a8)" href="http://www.extended_link.org" /><totalResults xmlns:testext="http://test.com/-/spec/test/0.1/">2</totalResults><startIndex xmlns:testext="http://test.com/-/spec/test/0.1/">2</startIndex><itemsPerPage xmlns:testext="http://test.com/-/spec/test/0.1/">2</itemsPerPage></feed>'
#     doesn't match '(?^:<testext:link xmlns:testext="http://test.com/-/spec/test/0.1/" href="http://www.extended_link.org"/>)'

#   Failed test 'ext method match'
#   at t/28-ext.t line 68.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <feed xmlns="http://purl.org/atom/ns#"><link xmlns="http://purl.org/atom/ns#" href="http://www.legacy_link.com" /><link xmlns="XML::Atom::Namespace=HASH(0x55ef340ce6a8)" href="http://www.extended_link.org" /><totalResults xmlns:testext="http://test.com/-/spec/test/0.1/">2</totalResults><startIndex xmlns:testext="http://test.com/-/spec/test/0.1/">2</startIndex><itemsPerPage xmlns:testext="http://test.com/-/spec/test/0.1/">2</itemsPerPage></feed>'
#     doesn't match '(?^:<testext:startIndex xmlns:testext="http://test.com/-/spec/test/0.1/">2</testext:startIndex>)'

#   Failed test 'standard link match'
#   at t/28-ext.t line 70.
#                   '<?xml version="1.0" encoding="UTF-8"?>
# <feed xmlns="http://purl.org/atom/ns#"><link xmlns="http://purl.org/atom/ns#" href="http://www.legacy_link.com" /><link xmlns="XML::Atom::Namespace=HASH(0x55ef340ce6a8)" href="http://www.extended_link.org" /><totalResults xmlns:testext="http://test.com/-/spec/test/0.1/">2</totalResults><startIndex xmlns:testext="http://test.com/-/spec/test/0.1/">2</startIndex><itemsPerPage xmlns:testext="http://test.com/-/spec/test/0.1/">2</itemsPerPage></feed>'
#     doesn't match '(?^:<link(?: xmlns="http://purl.org/atom/ns#")? href="http://www.legacy_link.com"/>)'
# Looks like you failed 6 tests of 8.
t/28-ext.t .......................
Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/8 subtests

#   Failed test at t/29-source.t line 9.
Can't call method "title" on an undefined value at t/29-source.t line 10.
# Looks like your test exited with 255 just after 1.
t/29-source.t ....................
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 9/9 subtests
t/30-datetime-stringification.t .. skipped: DateTime and DateTime::Format::Atom are required for tests
t/31-external-entities-libxml.t .. skipped: LibXML required for this test
External Entities disabled. at /home/yigit/Downloads/XML-Atom-0.42/blib/lib/XML/Atom.pm line 52.
t/31-external-entities-xpath.t ... ok
t/author-pod-syntax.t ............ skipped: these tests are for testing by the author

Test Summary Report
-------------------
t/11-entry.t                   (Wstat: 1536 Tests: 71 Failed: 6)
  Failed tests:  43, 48, 66-69
  Non-zero exit status: 6
t/12-feed.t                    (Wstat: 65280 Tests: 29 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 33 tests but ran 29.
t/13-atom1.t                   (Wstat: 65280 Tests: 5 Failed: 4)
  Failed tests:  2-5
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 23 tests but ran 5.
t/17-renames.t                 (Wstat: 65280 Tests: 1 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 5 tests but ran 1.
t/19-ext.t                     (Wstat: 512 Tests: 16 Failed: 2)
  Failed tests:  12-13
  Non-zero exit status: 2
t/23-category.t                (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
t/25-utf8-create.t             (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t/28-ext.t                     (Wstat: 1536 Tests: 8 Failed: 6)
  Failed tests:  2-4, 6-8
  Non-zero exit status: 6
t/29-source.t                  (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 9 tests but ran 1.
Files=27, Tests=229,  5 wallclock secs ( 0.08 usr  0.01 sys +  3.36 cusr  0.26 csys =  3.71 CPU)
Result: FAIL

Subroutine redefined warning occurs when used with XML::XPath

If we load XML::XPath after loading XML::Atom, Subroutine namespace_uri redefined warning occurs.

use strict;
use warnings;

use XML::Atom;
use XML::XPath;
# Subroutine namespace_uri redefined at .../lib/perl5/XML/XPath/Function.pm line 145.

XML::Atom overrides XML::Xpath::Function::namespace_uri method.

xml-atom/lib/XML/Atom.pm

Lines 24 to 32 in aca2600

*XML::XPath::Function::namespace_uri = sub {
my $self = shift;
my($node, @params) = @_;
my $ns = $node->getNamespace($node->getPrefix);
if (!$ns) {
$ns = ($node->getNamespaces)[0];
}
XML::XPath::Literal->new($ns ? $ns->getExpanded : '');
};

Since the logic of namespace_uri method is implemented in XML::XPath 1.20, we don't have to override namespace_uri method if using XML::XPath >= 1.20.

Test fails with XML-LibXML-2.0202

The test t/31-external-entities-libxml.t fails with XML-LibXML-2.0202.

#   Failed test 'resolved entity'
#   at t/31-external-entities-libxml.t line 57.
#                   '<p>No, Ben isn't updating. It's me testing out guest author functionality.</p>'
#     doesn't match '(?^:This is what you get when you do unit testing)'
# Looks like you failed 1 test of 4.
t/31-external-entities-libxml.t .. 
Dubious, test returned 1 (wstat 256, 0x100)

It happened, because loading external DTDs or external entities is disabled by default now (in XML-LibXML-2.0202).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.