scripting/reallysimple

Supporting custom namespaces?

Opened this issue · 3 comments

Hey there, love what you're doing here Dave to make things simple and easy to use :)

Question - should this parse custom namespaces? For example, I'm playing around with adding structured data for a "books" rss project and made a mockup here:

https://wooden-honorable-kale.glitch.me/feed.xml

So this code:

<item>
<title>Testing new fields</title>
<description>Some description </description>
<pubDate>Thu, 16 Jun 2022 00:00:00 +0000</pubDate>
<books:bookid>https://openlibrary.org/works/OL19098683W</books:bookid>
<link>http://tomcritchlow.com/2022/06/16/rejecting-specialization/</link>
<guid isPermaLink="true">http://tomcritchlow.com/2022/06/16/rejecting-specialization/</guid>
</item>

Get's parsed using reallysimple as:

        {
            "title": "Testing new fields",
            "description": "Some description",
            "pubDate": "2022-06-16T00:00:00.000Z",
            "link": "http://tomcritchlow.com/2022/06/16/rejecting-specialization/",
            "guid": "http://tomcritchlow.com/2022/06/16/rejecting-specialization/"
        }

Ideally I'd like to generate something like this:

        {
            "title": "Testing new fields",
            "description": "Some description",
            "pubDate": "2022-06-16T00:00:00.000Z",
           "books:bookid":"https://openlibrary.org/works/OL19098683W"
            "link": "http://tomcritchlow.com/2022/06/16/rejecting-specialization/",
            "guid": "http://tomcritchlow.com/2022/06/16/rejecting-specialization/"
        }

I'm a bit of a coding beginner (and not sure if I coded the custom namespace correctly?) so forgive me if this doesn't make sense or I'm doing something wrong

Hi Tom -- glad you like the reallySimple package and thanks for the support.

At this time it only understands core elements not namespaces other than the source namespace and some of the standard namespaces people use with RSS/Atom/RDF feeds.

I don't know if it should or shouldn't understand other namespaces. It was written to provide a good basic feed reading support for a feed reader, ie it understands data that's out there, and not all that it needs to (it's a work in progress).

Thanks Dave - yeah I'm not sure if you wanna build out that functionality either (keep it simple!) but I've appreciated using the package and recognize that custom namespaces are an edge case at best...

@tomcritchlow -- thanks! Here's how I want to approach this. If you find you're absolutely stopped by this missing feature, in a project you're doing (not just thinking about) speak up and we'll see what we can do.