Add examples from 0.9 spec, first past at change of rs:md use of modified= to from=
This commit is contained in:
parent
9bde0f5539
commit
d10ef804a5
@ -54,16 +54,16 @@ class ResourceContainer(object):
|
||||
self.md['capability']=capability
|
||||
|
||||
@property
|
||||
def modified(self):
|
||||
if ('modified' in self.md):
|
||||
return(self.md['modified'])
|
||||
def md_from(self):
|
||||
if ('from' in self.md):
|
||||
return(self.md['from'])
|
||||
else:
|
||||
return(None)
|
||||
|
||||
@modified.setter
|
||||
def modified(self,modified):
|
||||
"""Get/set the modified attribute of this resource container"""
|
||||
self.md['modified']=modified
|
||||
@md_from.setter
|
||||
def md_from(self,md_from):
|
||||
"""Get/set the from attribute of this resource container"""
|
||||
self.md['from']=md_from
|
||||
|
||||
|
||||
def link(self,rel):
|
||||
@ -82,8 +82,8 @@ class ResourceContainer(object):
|
||||
"""
|
||||
if ('capability' not in self.md and self.capability_md is not None):
|
||||
self.md['capability']=self.capability_md
|
||||
if ('modified' not in self.md):
|
||||
self.md['modified']=datetime_to_str(no_fractions=True)
|
||||
if ('from' not in self.md):
|
||||
self.md['from']=datetime_to_str(no_fractions=True)
|
||||
|
||||
def add(self, resource):
|
||||
"""Add a resource or an iterable collection of resources to this container
|
||||
|
||||
@ -13,8 +13,7 @@ http://www.openarchives.org/rs/resourcesync#DescResources
|
||||
|
||||
- mandatory <rs:md> element:
|
||||
-- must have capability="resourcelist"
|
||||
-- should have modified=".." attribute also, which should match the
|
||||
mtime of a file written.
|
||||
-- should have from=".." and/or until=".." attributes also
|
||||
- one <url> element for each resource
|
||||
|
||||
"""
|
||||
|
||||
@ -296,7 +296,7 @@ class Sitemap(object):
|
||||
"""
|
||||
md = {}
|
||||
# grab all understood attributes into md dict
|
||||
for att in ('capability','change','hash','length','modified','path','type'):
|
||||
for att in ('capability','change','hash','length','from','until','path','type'):
|
||||
val = md_element.attrib.get(att,None)
|
||||
if (val is not None):
|
||||
md[att] = val
|
||||
|
||||
@ -11,9 +11,9 @@ class TestCapabilityList(unittest.TestCase):
|
||||
rl = ResourceList()
|
||||
caps = CapabilityList()
|
||||
caps.add_capability( rl, "http://example.org/resourcelist.xml" )
|
||||
caps.md['modified'] = "2013-02-07T22:39:00"
|
||||
caps.md['from'] = "2013-02-07T22:39:00"
|
||||
self.assertEqual( len(caps), 1 )
|
||||
self.assertEqual( caps.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:md capability="capabilitylist" modified="2013-02-07T22:39:00" /><url><loc>http://example.org/resourcelist.xml</loc><rs:md capability="resourcelist" /></url></urlset>' )
|
||||
self.assertEqual( caps.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:md capability="capabilitylist" from="2013-02-07T22:39:00" /><url><loc>http://example.org/resourcelist.xml</loc><rs:md capability="resourcelist" /></url></urlset>' )
|
||||
|
||||
def test02_multiple(self):
|
||||
caps = CapabilityList()
|
||||
|
||||
@ -92,13 +92,13 @@ class TestChangeList(unittest.TestCase):
|
||||
xml = cl.as_xml()
|
||||
print xml
|
||||
self.assertTrue( re.search(r'<rs:md .*capability="changelist"', xml), 'XML has capability' )
|
||||
self.assertTrue( re.search(r'<rs:md .*modified="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has modified to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<rs:md .*from="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has from to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<url><loc>a</loc><lastmod>1970-01-01T00:00:01Z</lastmod>', xml), 'XML has resource a' )
|
||||
|
||||
def test30_parse(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="changelist" modified="2013-01-01"/>\
|
||||
<rs:md capability="changelist" from="2013-01-01"/>\
|
||||
<url><loc>/tmp/rs_test/src/file_a</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md change="updated" length="12" /></url>\
|
||||
<url><loc>/tmp/rs_test/src/file_b</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" /></url>\
|
||||
</urlset>'
|
||||
@ -106,7 +106,7 @@ class TestChangeList(unittest.TestCase):
|
||||
cl.parse(fh=StringIO.StringIO(xml))
|
||||
self.assertEqual( len(cl.resources), 2, 'got 2 resources')
|
||||
self.assertEqual( cl.md['capability'], 'changelist', 'capability set' )
|
||||
self.assertEqual( cl.md['modified'], '2013-01-01' )
|
||||
self.assertEqual( cl.md['from'], '2013-01-01' )
|
||||
|
||||
def test31_parse_no_capability(self):
|
||||
# missing capability is an error for changelist
|
||||
@ -121,7 +121,7 @@ class TestChangeList(unittest.TestCase):
|
||||
# the <rs:md capability="bad_capability".. should give error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="bad_capability" modified="2013-01-01"/>\
|
||||
<rs:md capability="bad_capability" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/bad_res_1</loc><lastmod>2012-03-14T18:37:36Z</lastmod></url>\
|
||||
</urlset>'
|
||||
cl=ChangeList()
|
||||
|
||||
@ -42,7 +42,7 @@ class TestClient(unittest.TestCase):
|
||||
with capture_stdout() as capturer:
|
||||
c.write_capability_list( { 'a':'uri_a', 'b':'uri_b' } )
|
||||
self.assertTrue( re.search(r'<urlset ',capturer.result) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="capabilitylist" modified=',capturer.result) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="capabilitylist" from=',capturer.result) )
|
||||
self.assertTrue( re.search(r'<url><loc>uri_a</loc><rs:md capability="a"',capturer.result) )
|
||||
self.assertTrue( re.search(r'<url><loc>uri_b</loc><rs:md capability="b"',capturer.result) )
|
||||
|
||||
@ -51,7 +51,7 @@ class TestClient(unittest.TestCase):
|
||||
with capture_stdout() as capturer:
|
||||
c.write_capability_list_index( [ 'a','b','c' ] )
|
||||
self.assertTrue( re.search(r'<sitemapindex ',capturer.result) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="capabilitylist" modified=',capturer.result) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="capabilitylist" from=',capturer.result) )
|
||||
#print capturer.result
|
||||
self.assertTrue( re.search(r'<sitemap><loc>a</loc></sitemap>',capturer.result) )
|
||||
self.assertTrue( re.search(r'<sitemap><loc>b</loc></sitemap>',capturer.result) )
|
||||
@ -84,14 +84,14 @@ class TestClient(unittest.TestCase):
|
||||
|
||||
with capture_stdout() as capturer:
|
||||
c.write_resource_list()
|
||||
self.assertTrue( re.search(r'<rs:md capability="resourcelist" modified="', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="resourcelist" from="', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<url><loc>http://example.org/dir1/file_a</loc>', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<url><loc>http://example.org/dir1/file_b</loc>', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<url><loc>http://example.org/dir2/file_x</loc>', capturer.result ) )
|
||||
# with an explicit paths setting only the specified paths will be included
|
||||
with capture_stdout() as capturer:
|
||||
c.write_resource_list(paths='resync/test/testdata/dir1')
|
||||
self.assertTrue( re.search(r'<rs:md capability="resourcelist" modified="', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<rs:md capability="resourcelist" from="', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<url><loc>http://example.org/dir1/file_a</loc><lastmod>2012-07-25T17:13:46Z</lastmod><rs:md length="20" /></url>', capturer.result ) )
|
||||
self.assertTrue( re.search(r'<url><loc>http://example.org/dir1/file_b</loc><lastmod>2001-09-09T01:46:40Z</lastmod><rs:md length="45" /></url>', capturer.result ) )
|
||||
self.assertFalse( re.search(r'dir2', capturer.result ) )
|
||||
|
||||
@ -113,10 +113,10 @@ class TestExamplesFromSpec(unittest.TestCase):
|
||||
self.assertFalse( capl.has_capability('bogus') )
|
||||
self.assertFalse( capl.has_capability('capabilitylist') )
|
||||
|
||||
def test_ex_2_7(self):
|
||||
"""resourcesync_ex2_7 is a simple Resource List Index with 2 Resource Lists"""
|
||||
def test_ex_2_8(self):
|
||||
"""resourcesync_ex2_8 is a simple Resource List Index with 2 Resource Lists"""
|
||||
rl=ResourceList()
|
||||
rl.read(uri='resync/test/testdata/examples_from_spec/resourcesync_ex_2_7.xml',index_only=True)
|
||||
rl.read(uri='resync/test/testdata/examples_from_spec/resourcesync_ex_2_8.xml',index_only=True)
|
||||
self.assertEqual( rl.capability, 'resourcelist' )
|
||||
self.assertEqual( len(rl.resources), 2, '2 resources')
|
||||
sms = sorted(rl.uris())
|
||||
@ -132,7 +132,7 @@ class TestExamplesFromSpec(unittest.TestCase):
|
||||
def test_build_ex_4_1(self):
|
||||
rl = ResourceList()
|
||||
rl.ln.append({'rel':'resourcesync','href':'http://example.com/dataset1/capabilitylist.xml'})
|
||||
rl.modified="2013-01-03T09:00:00Z"
|
||||
rl.md_from="2013-01-03T09:00:00Z"
|
||||
rl.add( Resource( uri='http://example.com/res1',
|
||||
lastmod='2013-01-02T13:00:00Z',
|
||||
md5='1584abdf8ebdc9802ac0c6a7402c03b6',
|
||||
@ -151,7 +151,7 @@ class TestExamplesFromSpec(unittest.TestCase):
|
||||
rl = ResourceList(resources_class=ResourceListOrdered) #order in example is non-canonical
|
||||
rl.sitemapindex=True
|
||||
rl.ln.append({'rel':'resourcesync','href':'http://example.com/dataset1/capabilitylist.xml'})
|
||||
rl.modified="2013-01-03T09:00:00Z"
|
||||
rl.md_from="2013-01-03T09:00:00Z"
|
||||
rl.add( Resource( uri='http://example.com/resourcelist3.xml',
|
||||
lastmod='2013-01-03T09:00:00Z' ))
|
||||
rl.add( Resource( uri='http://example.com/resourcelist2.xml',
|
||||
@ -165,7 +165,7 @@ class TestExamplesFromSpec(unittest.TestCase):
|
||||
rl = ResourceList()
|
||||
rl.ln.append({'rel':'resourcesync','href':'http://example.com/dataset1/capabilitylist.xml'})
|
||||
rl.ln.append({'rel':'up','href':'http://example.com/dataset1/resourcelist-index.xml'})
|
||||
rl.modified="2013-01-03T09:00:00Z"
|
||||
rl.md_from="2013-01-03T09:00:00Z"
|
||||
rl.add( Resource( uri='http://example.com/res3',
|
||||
lastmod='2013-01-03T09:00:00Z',
|
||||
md5='1584abdf8ebdc9802ac0c6a7402c8753',
|
||||
|
||||
@ -30,14 +30,14 @@ class TestListBase(unittest.TestCase):
|
||||
lb.add( Resource(uri='a',lastmod='2001-01-01',length=1234) )
|
||||
lb.add( Resource(uri='b',lastmod='2002-02-02',length=56789) )
|
||||
lb.add( Resource(uri='c',lastmod='2003-03-03',length=0) )
|
||||
lb.md['modified']=None #avoid now being added
|
||||
lb.md['from']=None #avoid now being added
|
||||
#print lb
|
||||
self.assertEqual( lb.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:md capability="unknown" /><url><loc>a</loc><lastmod>2001-01-01T00:00:00Z</lastmod><rs:md length="1234" /></url><url><loc>b</loc><lastmod>2002-02-02T00:00:00Z</lastmod><rs:md length="56789" /></url><url><loc>c</loc><lastmod>2003-03-03T00:00:00Z</lastmod><rs:md length="0" /></url></urlset>' )
|
||||
|
||||
def test_11_parse_2(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="unknown" modified="2013-02-12T14:09:00Z" />\
|
||||
<rs:md capability="unknown" from="2013-02-12T14:09:00Z" />\
|
||||
<url><loc>/tmp/rs_test/src/file_a</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" /></url>\
|
||||
<url><loc>/tmp/rs_test/src/file_b</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" /></url>\
|
||||
</urlset>'
|
||||
|
||||
@ -21,7 +21,7 @@ class TestListBaseWithIndex(unittest.TestCase):
|
||||
lb.add( Resource(uri='a',lastmod='2001-01-01',length=1234) )
|
||||
lb.add( Resource(uri='b',lastmod='2002-02-02',length=56789) )
|
||||
lb.add( Resource(uri='c',lastmod='2003-03-03',length=0) )
|
||||
lb.md['modified']=None #avoid now being added
|
||||
lb.md['from']=None #avoid now being added
|
||||
#print lb
|
||||
self.assertEqual( lb.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:md capability="unknown" /><url><loc>a</loc><lastmod>2001-01-01T00:00:00Z</lastmod><rs:md length="1234" /></url><url><loc>b</loc><lastmod>2002-02-02T00:00:00Z</lastmod><rs:md length="56789" /></url><url><loc>c</loc><lastmod>2003-03-03T00:00:00Z</lastmod><rs:md length="0" /></url></urlset>' )
|
||||
|
||||
@ -38,7 +38,7 @@ class TestListBaseWithIndex(unittest.TestCase):
|
||||
self.assertRaises( ListBaseIndexError, lb.as_xml )
|
||||
# set explicit count and all will be OK
|
||||
lb = ListBaseWithIndex( resources=iter(r), count=3 )
|
||||
lb.md['modified']=None #avoid now being added
|
||||
lb.md['from']=None #avoid now being added
|
||||
#print lb
|
||||
self.assertEqual( lb.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:md capability="unknown" /><url><loc>a</loc><lastmod>2001-01-01T00:00:00Z</lastmod><rs:md length="1234" /></url><url><loc>b</loc><lastmod>2002-02-02T00:00:00Z</lastmod><rs:md length="56789" /></url><url><loc>c</loc><lastmod>2003-03-03T00:00:00Z</lastmod><rs:md length="0" /></url></urlset>' )
|
||||
|
||||
@ -46,7 +46,7 @@ class TestListBaseWithIndex(unittest.TestCase):
|
||||
def test_11_parse_2(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="unknown" modified="2013-02-12T14:09:00Z" />\
|
||||
<rs:md capability="unknown" from="2013-02-12T14:09:00Z" />\
|
||||
<url><loc>/tmp/rs_test/src/file_a</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" /></url>\
|
||||
<url><loc>/tmp/rs_test/src/file_b</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" /></url>\
|
||||
</urlset>'
|
||||
|
||||
@ -14,13 +14,13 @@ class TestResourceDump(unittest.TestCase):
|
||||
xml = rd.as_xml()
|
||||
print xml
|
||||
self.assertTrue( re.search(r'<rs:md .*capability="resourcedump"', xml), 'XML has capability' )
|
||||
self.assertTrue( re.search(r'<rs:md .*modified="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has modified to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<rs:md .*from="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has from to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<url><loc>a.zip</loc><lastmod>1970-01-01T00:00:01Z</lastmod></url>', xml), 'XML has resource a' )
|
||||
|
||||
def test10_parse(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="resourcedump" modified="2013-01-01"/>\
|
||||
<rs:md capability="resourcedump" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/a.zip</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12345" /></url>\
|
||||
<url><loc>http://example.com/b.zip</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="56789" /></url>\
|
||||
</urlset>'
|
||||
@ -28,7 +28,7 @@ class TestResourceDump(unittest.TestCase):
|
||||
rd.parse(fh=StringIO.StringIO(xml))
|
||||
self.assertEqual( len(rd.resources), 2, 'got 2 resource dumps')
|
||||
self.assertEqual( rd.md['capability'], 'resourcedump', 'capability set' )
|
||||
self.assertEqual( rd.md['modified'], '2013-01-01' )
|
||||
self.assertEqual( rd.md['from'], '2013-01-01' )
|
||||
self.assertTrue( 'http://example.com/a.zip' in rd.resources )
|
||||
self.assertTrue( rd.resources['http://example.com/a.zip'].length, 12345 )
|
||||
self.assertTrue( 'http://example.com/b.zip' in rd.resources )
|
||||
@ -38,7 +38,7 @@ class TestResourceDump(unittest.TestCase):
|
||||
# For a resource dump this should be an error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md modified="2013-01-01"/>\
|
||||
<rs:md from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/a.zip</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" /></url>\
|
||||
</urlset>'
|
||||
rd=ResourceDump()
|
||||
@ -48,7 +48,7 @@ class TestResourceDump(unittest.TestCase):
|
||||
# the <rs:md capability="bad_capability".. should give error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="bad_capability" modified="2013-01-01"/>\
|
||||
<rs:md capability="bad_capability" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/bad_res_1</loc><lastmod>2012-03-14T18:37:36Z</lastmod></url>\
|
||||
</urlset>'
|
||||
rd=ResourceDump()
|
||||
|
||||
@ -14,13 +14,13 @@ class TestResourceDumpManifest(unittest.TestCase):
|
||||
xml = rdm.as_xml()
|
||||
print xml
|
||||
self.assertTrue( re.search(r'<rs:md .*capability="resourcedump-manifest"', xml), 'XML has capability' )
|
||||
self.assertTrue( re.search(r'<rs:md .*modified="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has modified to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<rs:md .*from="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has from to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<url><loc>a.zip</loc><lastmod>1970-01-01T00:00:01Z</lastmod></url>', xml), 'XML has resource a' )
|
||||
|
||||
def test10_parse(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="resourcedump-manifest" modified="2013-01-01"/>\
|
||||
<rs:md capability="resourcedump-manifest" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/res1</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" path="/res1" /></url>\
|
||||
<url><loc>http://example.com/res2</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" path="/res2"/></url>\
|
||||
</urlset>'
|
||||
@ -28,7 +28,7 @@ class TestResourceDumpManifest(unittest.TestCase):
|
||||
rdm.parse(fh=StringIO.StringIO(xml))
|
||||
self.assertEqual( len(rdm.resources), 2, 'got 2 resource dumps')
|
||||
self.assertEqual( rdm.md['capability'], 'resourcedump-manifest', 'capability set' )
|
||||
self.assertEqual( rdm.md['modified'], '2013-01-01' )
|
||||
self.assertEqual( rdm.md['from'], '2013-01-01' )
|
||||
self.assertTrue( 'http://example.com/res1' in rdm.resources )
|
||||
self.assertTrue( rdm.resources['http://example.com/res1'].length, 12 )
|
||||
self.assertTrue( rdm.resources['http://example.com/res1'].path, '/res1' )
|
||||
@ -39,7 +39,7 @@ class TestResourceDumpManifest(unittest.TestCase):
|
||||
# For a resource dump this should be an error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md modified="2013-01-01"/>\
|
||||
<rs:md from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/res1</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" path="/res1" /></url>\
|
||||
<url><loc>http://example.com/res2</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" path="/res2"/></url>\
|
||||
</urlset>'
|
||||
@ -50,7 +50,7 @@ class TestResourceDumpManifest(unittest.TestCase):
|
||||
# the <rs:md capability="bad_capability".. should give error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="bad_capability" modified="2013-01-01"/>\
|
||||
<rs:md capability="bad_capability" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/a.zip</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="12" /></url>\
|
||||
</urlset>'
|
||||
rdm=ResourceDumpManifest()
|
||||
|
||||
@ -133,13 +133,13 @@ class TestResourceList(unittest.TestCase):
|
||||
xml = rl.as_xml()
|
||||
print xml
|
||||
self.assertTrue( re.search(r'<rs:md .*capability="resourcelist"', xml), 'XML has capability' )
|
||||
self.assertTrue( re.search(r'<rs:md .*modified="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has modified to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<rs:md .*from="\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\dZ"', xml), 'XML has from to seconds precision (and not more)' )
|
||||
self.assertTrue( re.search(r'<url><loc>a</loc><lastmod>1970-01-01T00:00:01Z</lastmod></url>', xml), 'XML has resource a' )
|
||||
|
||||
def test30_parse(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="resourcelist" modified="2013-01-01"/>\
|
||||
<rs:md capability="resourcelist" from="2013-01-01"/>\
|
||||
<url><loc>/tmp/rs_test/src/file_a</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md change="updated" length="12" /></url>\
|
||||
<url><loc>/tmp/rs_test/src/file_b</loc><lastmod>2012-03-14T18:37:36Z</lastmod><rs:md length="32" /></url>\
|
||||
</urlset>'
|
||||
@ -147,7 +147,7 @@ class TestResourceList(unittest.TestCase):
|
||||
rl.parse(fh=StringIO.StringIO(xml))
|
||||
self.assertEqual( len(rl.resources), 2, 'got 2 resources')
|
||||
self.assertEqual( rl.md['capability'], 'resourcelist', 'capability set' )
|
||||
self.assertEqual( rl.md['modified'], '2013-01-01' )
|
||||
self.assertEqual( rl.md['from'], '2013-01-01' )
|
||||
|
||||
def test31_parse_no_capability(self):
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
@ -158,13 +158,13 @@ class TestResourceList(unittest.TestCase):
|
||||
rl.parse(fh=StringIO.StringIO(xml))
|
||||
self.assertEqual( len(rl.resources), 1, 'got 1 resource')
|
||||
self.assertEqual( rl.md['capability'], 'resourcelist', 'capability set by reading routine' )
|
||||
self.assertFalse( 'modified' in rl.md )
|
||||
self.assertFalse( 'from' in rl.md )
|
||||
|
||||
def test32_parse_bad_capability(self):
|
||||
# the <rs:md capability="bad_capability".. should give error
|
||||
xml='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n\
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/">\
|
||||
<rs:md capability="bad_capability" modified="2013-01-01"/>\
|
||||
<rs:md capability="bad_capability" from="2013-01-01"/>\
|
||||
<url><loc>http://example.com/bad_res_1</loc><lastmod>2012-03-14T18:37:36Z</lastmod></url>\
|
||||
</urlset>'
|
||||
rl=ResourceList()
|
||||
|
||||
@ -3,18 +3,18 @@
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist-archive"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
<rs:md capability="resourcelist-archive"
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/changelist1.xml</loc>
|
||||
<lastmod>2013-01-01T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/resourcelist1.xml</loc>
|
||||
<lastmod>2012-11-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/changelist2.xml</loc>
|
||||
<lastmod>2013-01-02T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/resourcelist2.xml</loc>
|
||||
<lastmod>2012-12-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/changelist3.xml</loc>
|
||||
<loc>http://example.com/resourcelist3.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
@ -3,18 +3,18 @@
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changedump-archive"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
<rs:md capability="resourcedump-archive"
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/changedump-w1.xml</loc>
|
||||
<lastmod>2012-12-20T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/resourcedump1.xml</loc>
|
||||
<lastmod>2012-11-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/changedump-w2.xml</loc>
|
||||
<lastmod>2012-12-27T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/resourcedump2.xml</loc>
|
||||
<lastmod>2012-12-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/changedump-w3.xml</loc>
|
||||
<loc>http://example.com/resourcedump3.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
@ -3,18 +3,19 @@
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcelist-archive"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
<rs:md capability="changelist-archive"
|
||||
from="2013-01-01T09:00:00Z"
|
||||
until="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/resourcelist1.xml</loc>
|
||||
<lastmod>2012-11-03T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/changelist1.xml</loc>
|
||||
<lastmod>2013-01-01T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/resourcelist2.xml</loc>
|
||||
<lastmod>2012-12-03T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/changelist2.xml</loc>
|
||||
<lastmod>2013-01-02T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/resourcelist3.xml</loc>
|
||||
<loc>http://example.com/changelist3.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
@ -3,18 +3,19 @@
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcedump-archive"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
<rs:md capability="changedump-archive"
|
||||
from="2012-12-20T09:00:00Z"
|
||||
until="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/resourcedump1.xml</loc>
|
||||
<lastmod>2012-11-03T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/changedump-w1.xml</loc>
|
||||
<lastmod>2012-12-20T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/resourcedump2.xml</loc>
|
||||
<lastmod>2012-12-03T09:00:00Z</lastmod>
|
||||
<loc>http://example.com/changedump-w2.xml</loc>
|
||||
<lastmod>2012-12-27T09:00:00Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/resourcedump3.xml</loc>
|
||||
<loc>http://example.com/changedump-w3.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="describedby"
|
||||
href="http://example.com/dataset1/info_about_source.xml"/>
|
||||
<rs:md capability="capabilitylist"
|
||||
modified="2013-01-02T14:00:00Z"/>
|
||||
href="http://example.com/info_about_set1_of_resources.xml"
|
||||
type="application/xml"/>
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/resourcesync_description.xml"/>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcelist.xml</loc>
|
||||
<rs:md capability="resourcelist"/>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
</url>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res2.pdf</loc>
|
||||
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcedump"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/resourcedump.zip</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcedump-manifest"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-03T03:00:00Z</lastmod>
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln href="http://example.com/info-about-source.xml"
|
||||
rel="describedby"
|
||||
type="application/xml"/>
|
||||
<rs:md capability="capabilitylist"
|
||||
modified="2013-01-02T14:00:00Z"/>
|
||||
<rs:ln href="http://example.com/info_about_set1_of_resources.xml"
|
||||
rel="describedby"/>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcelist.xml</loc>
|
||||
<rs:md capability="resourcelist"/>
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
<sitemap>
|
||||
<loc>http://example.com/resourcelist-part2.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>http://example.com/resourcelist-part1.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</sitemap>
|
||||
</sitemapindex>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln href="http://example.com/info-about-source.xml"
|
||||
rel="describedby"
|
||||
type="application/xml"/>
|
||||
<rs:md capability="resourcesync"/>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/capabilitylist.xml</loc>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<rs:ln href="http://example.com/info_about_set1_of_resources.xml"
|
||||
rel="describedby"/>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
14
resync/test/testdata/examples_from_spec/resourcesync_ex_2_8.xml
vendored
Normal file
14
resync/test/testdata/examples_from_spec/resourcesync_ex_2_8.xml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:md capability="resourcelist"
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<sitemap>
|
||||
<loc>http://example.com/resourcelist-part2.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>http://example.com/resourcelist-part1.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
</sitemap>
|
||||
</sitemapindex>
|
||||
@ -4,7 +4,7 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<sitemap>
|
||||
<loc>http://example.com/resourcelist3.xml</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<rs:ln rel="up"
|
||||
href="http://example.com/dataset1/resourcelist-index.xml"/>
|
||||
<rs:md capability="resourcelist"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res3</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcedump"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/resourcedump-part3.zip</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="resourcedump-manifest"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-03T09:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1.html</loc>
|
||||
<lastmod>2013-01-02T11:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changedump"
|
||||
modified="2013-01-03T09:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-08T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/changedump-part3.zip</loc>
|
||||
<lastmod>2013-01-03T09:00:00Z</lastmod>
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changedump-manifest"
|
||||
modified="2013-01-03T21:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1.html</loc>
|
||||
<lastmod>2013-01-01T05:00:00Z</lastmod>
|
||||
<lastmod>2013-01-01T15:00:00Z</lastmod>
|
||||
<rs:md change="created"
|
||||
hash="md5:1c1b0e264fa9b7e1e9aa6f9db8d6362b"
|
||||
length="4339"
|
||||
@ -16,7 +17,7 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/res2.pdf</loc>
|
||||
<lastmod>2013-01-01T09:00:00Z</lastmod>
|
||||
<lastmod>2013-01-01T19:00:00Z</lastmod>
|
||||
<rs:md change="updated"
|
||||
hash="md5:f906610c3d4aa745cb2b986f25b37c5a
|
||||
sha-256:f138185cddef488264a0323aee56e7647e89cd7a4d6e45ba28b3be26234a6d09"
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-02T17:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://aggregator2.example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-04T15:00:00Z"/>
|
||||
from="2013-01-03T11:00:00Z"
|
||||
until="2013-01-04T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://aggregator2.example.com/res1.html</loc>
|
||||
<lastmod>2013-01-04T09:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-02T18:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1.html</loc>
|
||||
<lastmod>2013-01-02T18:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res4</loc>
|
||||
<lastmod>2013-01-02T17:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res2.pdf</loc>
|
||||
<lastmod>2013-01-02T18:00:00Z</lastmod>
|
||||
@ -25,8 +26,8 @@
|
||||
<rs:ln rel="describes"
|
||||
href="http://example.com/res2.pdf"
|
||||
modified="2013-01-02T19:00:00Z"
|
||||
hash="md5:1e0d5cb8ef6ba40c99b14c0237be735e"
|
||||
length="14599"
|
||||
hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6"
|
||||
length="8876"
|
||||
type="application/pdf"/>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
@ -4,17 +4,18 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-03T07:00:00Z</lastmod>
|
||||
<lastmod>2013-01-02T18:00:00Z</lastmod>
|
||||
<rs:md hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6"
|
||||
length="8876"
|
||||
type="text/html"
|
||||
change="updated"/>
|
||||
<rs:ln rel="memento"
|
||||
href="http://example.com/20130103070000/res1"
|
||||
modified="2013-01-03T07:00:00Z"
|
||||
modified="2013-01-02T19:00:00Z"
|
||||
hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6"
|
||||
length="8876"
|
||||
type="text/html"/>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://example.com/res1</loc>
|
||||
<lastmod>2013-01-03T07:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T11:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T11:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://original.example.com/res1.html</loc>
|
||||
<lastmod>2013-01-03T07:00:00Z</lastmod>
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://aggregator1.example.com/dataset1/capabilitylist.xml"/>
|
||||
<rs:md capability="changelist"
|
||||
modified="2013-01-03T21:00:00Z"/>
|
||||
from="2013-01-01T11:00:00Z"
|
||||
until="2013-01-03T21:00:00Z"/>
|
||||
<url>
|
||||
<loc>http://aggregator1.example.com/res1.html</loc>
|
||||
<lastmod>2013-01-03T20:00:00Z</lastmod>
|
||||
|
||||
@ -2,23 +2,25 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="describedby"
|
||||
href="http://example.com/dataset1/info_about_source.xml"/>
|
||||
<rs:md capability="capabilitylist"
|
||||
modified="2013-01-02T14:00:00Z"/>
|
||||
href="http://example.com/info_about_source.xml"
|
||||
type="application/xml"/>
|
||||
<rs:md capability="resourcesync"/>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcelist.xml</loc>
|
||||
<rs:md capability="resourcelist"/>
|
||||
<loc>http://example.com/capabilitylist1.xml</loc>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<rs:ln href="http://example.com/info_about_set1_of_resources.xml"
|
||||
rel="describedby"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcedump.xml</loc>
|
||||
<rs:md capability="resourcedump"/>
|
||||
<loc>http://example.com/capabilitylist2.xml</loc>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<rs:ln href="http://example.com/info_about_set2_of_resources.xml"
|
||||
rel="describedby"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/changelist.xml</loc>
|
||||
<rs:md capability="changelist"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/changedump.xml</loc>
|
||||
<rs:md capability="changedump"/>
|
||||
<loc>http://example.com/capabilitylist3.xml</loc>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<rs:ln href="http://example.com/info_about_set3_of_resources.xml"
|
||||
rel="describedby"/>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
26
resync/test/testdata/examples_from_spec/resourcesync_ex_9_2.xml
vendored
Normal file
26
resync/test/testdata/examples_from_spec/resourcesync_ex_9_2.xml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
||||
<rs:ln rel="describedby"
|
||||
href="http://example.com/info_about_set1_of_resources.xml"
|
||||
type="application/xml"/>
|
||||
<rs:ln rel="resourcesync"
|
||||
href="http://example.com/resourcesync_description.xml"/>
|
||||
<rs:md capability="capabilitylist"/>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcelist.xml</loc>
|
||||
<rs:md capability="resourcelist"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/resourcedump.xml</loc>
|
||||
<rs:md capability="resourcedump"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/changelist.xml</loc>
|
||||
<rs:md capability="changelist"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>http://example.com/dataset1/changedump.xml</loc>
|
||||
<rs:md capability="changedump"/>
|
||||
</url>
|
||||
</urlset>
|
||||
8
resync/test/testdata/examples_from_spec/resourcesync_ex_9_4.xml
vendored
Normal file
8
resync/test/testdata/examples_from_spec/resourcesync_ex_9_4.xml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="resourcesync"
|
||||
href="http://www.example.com/dataset1/capabilitylist.xml"/>
|
||||
...
|
||||
</head>
|
||||
<body>...</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user