OPML source in river.js

66 views
Skip to first unread message

Dave Winer

unread,
Sep 17, 2012, 1:24:47 PM9/17/12
to river-...@googlegroups.com
Here's an experimental feature.


We have a new ability in worldoutline-land, OPML comments.

They just joined with RSS, so the feed emanating from my comments site, has OPML in it. 

And this flows through River2, so I thought why not put it in the river JS file as well, and see what we can do with it.

This is the place I bring such innovations. :-)

Dave


Dody Gunawinata

unread,
Sep 19, 2012, 8:27:23 AM9/19/12
to river-...@googlegroups.com
Hi Dave,

Is there any reason for the outline element (http://dropbox.scripting.com/dave/misc/riverWithJsonEncodedOPML.js) to contain '#value' instead of just 'value'

{
					"text": "I believe I have the feature working, but I need a fresh comment to test it out. ",
					"#value": ""
					}


JSON parsing in static languages uses reflection to map from JSON to an object and none of these languages support #value as valid name.

Dave Winer

unread,
Sep 19, 2012, 8:41:19 AM9/19/12
to river-...@googlegroups.com
Honest answer -- I don't remember -- but I do remember looking for prior art and asking people who knew both JSON and XML. The question was how to convert from an XML structure to a JSON structure. The problem is that XML objects have a value and attributes. The question is how to distinguish between an attribute named value and the value of the object. Pretty sure I was doing it the same way someone else did it. Unfortunately that was before I was doing worknotes, if I was I'm sure I would have kept a reference to the prior art. But I have a pretty strong feeling that there was prior art. Dave

Dody Gunawinata

unread,
Sep 19, 2012, 8:58:18 AM9/19/12
to river-...@googlegroups.com
Ah got it. Thanks. One more question, do you have a sample outline in JS that show an outline inside another (just like its XML counterpart)?


On Monday, September 17, 2012 7:24:47 PM UTC+2, Dave Winer wrote:

Dave Winer

unread,
Sep 19, 2012, 9:25:10 AM9/19/12
to river-...@googlegroups.com
I think I provided a link to a sample doc at the beginning of this thread.

Dody Gunawinata

unread,
Sep 19, 2012, 9:36:45 AM9/19/12
to river-...@googlegroups.com
Yes (http://dropbox.scripting.com/dave/misc/riverWithJsonEncodedOPML.js)

The outline element in that file is flat (one outline after another in sequence).

  • Item1
  • Item2
  • Item3
I wonder about how the JSON will look like if the outline is expanded
  • Item1
    • Item1A
  • Item2
  • Item3
    • Item3A
which is a common scenario.

Will it look like as follows?

"outline": [
      { "text": "Item 1 ",
        "#value": "",
        "outline" : [
            {
               "text" : "Item 1 A",
               "#value" : ""
            }
        ]
      },
      { "text" : "Item 2",
        "#value" : ""
      }
]

Dave Winer

unread,
Sep 19, 2012, 9:49:48 AM9/19/12
to river-...@googlegroups.com
Dody, I noticed that you have posted content on my site using OPML Comments, so you can create whatever test case you want by simply creating a new comment with the structure you want to represent. It will flow through to the river within a few minutes at most. Dave

Dody Gunawinata

unread,
Sep 19, 2012, 10:11:17 AM9/19/12
to river-...@googlegroups.com
Awesome - I didn't know this is already on live server.

dodyg

unread,
Sep 20, 2012, 4:02:28 AM9/20/12
to river-...@googlegroups.com
Hi Dave,

I tried to find riverjs for  http://threads2.scripting.com/  (to test opml source element) without any success. Can you please point me out where to find this file?

Dody Gunawinata 

Dave Winer

unread,
Sep 20, 2012, 8:24:29 AM9/20/12
to river-...@googlegroups.com
Dody, there is no single river.js "for" that site.

There is an RSS feed.

http://static.scripting.com/pensacola/comments/rss.xml

And that feed is followed by my personal river.

http://tabs.mediahackers.org/?panel=dave

And it has a river.js file.

'http://static.scripting.com/houston/rivers/iowaRiver3.js

You will find your OPML comments in that file with the OPML encoded as JSON.

Dave

Dody Gunawinata

unread,
Sep 20, 2012, 9:34:31 AM9/20/12
to river-...@googlegroups.com
Ah got it. Yesterday and today I was looking at those feeds searching for "opml" and "outline" which returned no result so I assumed that I was looking at the wrong feeds. I must have looked at them at the wrong time.

Dody Gunawinata

unread,
Sep 23, 2012, 11:39:54 AM9/23/12
to river-...@googlegroups.com
OK I finally catch the OPML element in the wild  http://i.imgur.com/sH0to.png  (with sub-outlines) at  http://static.scripting.com/houston/rivers/iowaRiver3.js. Now I have enough material to work on.

Dave Winer

unread,
Sep 23, 2012, 11:41:04 AM9/23/12
to river-...@googlegroups.com
Good! 

Be sure to save off a copy of the river.js because it will scroll off..

Dave
Reply all
Reply to author
Forward
0 new messages