Exporting XML from nodes and fields

mediashock - May 30, 2007 - 19:54

How would i be able to create a CUSTOM XML file where i can pull info from a COntent type..

so for example i have a content type for portfolio . it has title, image1 , image2, image3, etc

and i would like to create a XML feed that has the info into seperate tags

<title>my title</title>
<image1>myimage.jpg</image1>
etc

can do. why?

dman - May 30, 2007 - 22:29

You can do that by creating a theme template that outputs your custom schema instead of HTML.

However, I'd suggest not doing so unless you really need to integrate with a system that already has its own propriatary XML dialect that you are converting to.
Are you sure that really really simple, microformat-annotated XHTML will not do the job just as well as any arbitrary language you can make up on the spot?

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

Well i want to read this

mediashock - May 31, 2007 - 00:05

Well i want to read this information from FLASH and some ajax applications.. thats the simplest method i could think of since i dont have much time to spend on this.. :(

how would i create a theme with the template? i mean to export it in that way..

Just tried this method and

mediashock - May 31, 2007 - 00:43

Just tried this method and it would work i guess but i could not usethe backend because if i edit the template it affects the whole site..

i just want to output one of my VIEWS in a XML format but not the typical RSS feed format.. i need a custom one..

i searched over and over.. cant find a simple solution

Simple, no.

dman - May 31, 2007 - 01:32

Ah yeah, I forgot about the theme switching problem. May be a long way around to avoid that.

For a direct, back-end interface into node data,
You might find some clues in the way dynamicload does its AJAX full-page requests.

It captures all requests under a menu path [dynamicload_menu()]
So that a request for /dynamicload/js/node/17 returns a special data-only version of page node/17

This does it in JSON, but if you use pagearray also (a module that breaks down page requests into data blocks) and copy the dynamicload_menu() and dynamicload_js() functions into a module of your own, you could pretty easily pump out XML instead.

"Pretty easily" being a relative term, of course. It actually requires a bit of knowlege of Drupal internals, HTTP protocols, XML, and PHP to do it right ;-)

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

crap... i just recently

mediashock - May 31, 2007 - 01:34

crap... i just recently started using drupal..

could it be possible to modify the way the RSS feeds are being displayed? i took a look at the views_rss.module and i am LOST in there
but if i could modify that .. that would work too..

Yes, that's what I've done.

criznach - May 31, 2007 - 14:00

Yes, that's what I've done. I used the contemplate module to alter the RSS template for certain node types. Of course, that changes how those nodes look in real RSS feeds, but maybe that's not a problem.

 
 

Drupal is a registered trademark of Dries Buytaert.