Well, 1st there is an ESQL taglib. This lets you directly access a database in 
an XSP page.

2nd as you suggest you can create a provider. A dirt simple provider would use 
some query params to generate a SELECT of some sort, generate perl data using 
some variation of fetchrow-hashref() and then use the XML::PerlData module to 
spit out XML based on it. Very generic and pretty good if you don't need 
giant result sets.

The 3rd way, and the way I think most complex webapps are likely to use is to 
simply write your own XSP taglib which accepts parameters, generates a query, 
does some processing on whatever it gets back, and spits out XML based on 
that. The advantage here is that in many cases the output can be a lot 
smaller since you immediately handle it. Granted you could do the same logic 
in a provider, but I just see taglibs as being more generic (ie you can get 
your input params from anywhere XSP can get data from whereas a provider is 
really pretty limited in that respect). 

Taglibs tend to be easier to develop too IMHO. I think the upside to the 
provider would be if you don't use XSP then obviously you can eliminate that 
machinery and directly from your provider to XSLT or SAX or whatever. 

For that matter with EXSLT you can use perl callbacks in XSLT to access a 
database if you wanted to and return the results as nodesets!!!! Truely one 
can burn too many braincells thinking about it. I like XSP well enough, so I 
lean on it a lot...


On Monday 03 February 2003 11:45 am, David Chaplin-Loebell wrote:
> So...
>
> How are people turning information from SQL databases into XML for AxKit?
> I'm thinking the best way to do this would be to use a provider.  Has
> anyone done this yet?
>
> My concept is that a generic provider could take the rows returned by DBI
> and parse them into XML.
>
> So a query like:  SELECT id, name FROM foo
>
> which returns:
> id name
> -- ----
> 1  fish
> 2  cat
>
> would come out of the provider like so
>
> <foo>
>  <id>1</id>
>  <name>fish</name>
> </foo>
> <foo>
>  <id>1</id>
>  <name>fish</name>
> </foo>
>
> Has anyone already written this provider?  Am I on the right track in
> assuming this would be how to do it?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Tod Harter
Giant Electronic Brain

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to