Closed soundsc closed 7 years ago
Even though it's closed, I think it might be useful to explain why we have "creator" without "dc:" and it still works. (If anything, I might forget this stuff one day, and it'll be good to have it written down so that I can link to it.)
First of all, "dc" part is not fixed—it can be named however the document creator wants. This is done using xmlns
attribute of the document root. This thingy is just an alias for the URI that specifies what definitions should be used. Dublin Core is a set of such definitions, and its URI is http://purl.org/dc/elements/1.1/
. The following two documents have equivalent meaning:
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0">
<dc:publisher>A big publishing house</dc:publisher>
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:our_custom_name_for_dublin_core="http://purl.org/dc/elements/1.1/"
xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://meerkat.oreillynet.com/?_fl=rss1.0">
<our_custom_name_for_dublin_core:publisher>A big publishing house</our_custom_name_for_dublin_core:publisher>
They differ only in the alias used for Dublin Core.
Second, and of most use with regards to this PR: we use libxml2
for parsing feeds, and it resolves these namespaces into their respective URIs. So when Newsbeuter is processing the parsed result, it doesn't see dc:publisher
or our_custom_name_for_dublin_core:publisher
—it sees a node with name publisher
and namespace http://purl.org/dc/elements/1.1/
. The latter happens to be defined in Newsbeuter as a string constant DC_URI
. These two things are exactly what's passed to our node_is
method.
Hope this unveils the mystery of how this all works despite "dc:" never being mentioned in the code.
Change item field
creator
todc:creator
. This corresponds to the Dublin Core specification as well as real-world usage. See issue #143.