[pmwiki-users] getting xml output from a dataset

Patrick R. Michaud pmichaud at pobox.com
Mon Sep 10 11:39:16 CDT 2007


On Mon, Sep 10, 2007 at 11:40:32AM +0200, Dominique Faure wrote:
> On 9/9/07, Henrik <henrik.bechmann at sympatico.ca> wrote:
> > I'm looking for a strategy to generate custom xml output from a
> > structured wiki page.
> >
> > I'm using google maps api to generate maps like this:
> > http://www.dufferinpark.ca/market/wiki/wiki.php?n=LocalProducers.Map
> >
> > Google maps takes an xml table as input, but I would like to have a wiki
> > front end for this.
> >
> > So I propose a wikimarkup like this:
> >
> > (:datatable farmers:)
> > (:datarecord item:)
> > name:Akiwenzie's Fish
> > contact:Andrew Akiwenzie
> > info:/market/wiki/wiki.php?n=Vendors.FrontPage#AkiwenziesFish
> [...]
> IMHO, it could be also nice to have individual pages for each farmer,
> defining the data as a set of PageTextVariables.

I agree.  This is more in keeping with PmWiki's internal model;
it also means that one can easily select subsets of the data
using (:pagelist:).

However, if multiple records are to appear in a single page, 
I would prefer to use anchors to mark the sections:

  [[#item1]]
  (:datarecord item:)
  name:Akiwenzie's Fish
  contact:Andrew Akiwenzie
  ...
  [[#item2]]
  name:Beretta's Organics
  contact:Cynthia Beretta
  info:/market/wiki/wiki.php?n=Vendors.FrontPage#beretta
  ...

This makes it more amenable to using something like the SectionList
recipe, as well as meaning that one could eventually do something like
like {SomePage#item2$:name}  to extract the $:name ptv from the #item2
section of SomePage.

> > Question: How would I approach this? I'm thinking
> > Group.DataPage?action=xml hooked into some kind of processing. 

It's worth noting that the feeds.php script is already a useful
mechanism for generating xml output from any arbitrary list of pages.
Things like ?action=rss and ?action=rdf are already taking a list
of pages and producing xml output from them -- so to add a new
xml output format one simply defines entries in the $FeedFmt
array.  Then it all "just works".  I can see about making a
PITS-based example if that's at all helpful.

Pm



More information about the pmwiki-users mailing list