XML Output of EZ content - A Method

Author Message

Paul Wilson

Wednesday 30 May 2007 7:06:00 am

Hi,

Just writing to share some notes on a method I've successfully used for XML output of EZ content.

Perhaps I've missed something, but while RSS export is easy enough, getting other data out seems difficult. The method I've used is to avoid EZ entirely. I had to create specifically-formatted XML files based on up-to-date EZ content.

So, very briefly, what I've done is:
1) Create a basic PHP script to access the EZ database for my site;
2) Using debug mode, I selected "SQL Debug Output" (admin interface quick settings). This shows the queries for drawing out EZ nodes and content.
3) Analyse the sql debug output and adapt it to collect the data needed and produce an XML file as output.
4) (I've created a cronjob so that this php script runs automatically).

Yeah, okay, there's a fair amount of work in step 3, but I got what I needed in under a day. The fact that EZ shows the queries it's using is a great help.

Anyway, for anyone stuck getting XML output, I hope this helps.

- Paul

STEVO +

Wednesday 30 May 2007 12:31:57 pm

on the contrary, getting xml output from ez is easy.

bruce morrison's written about it here:
http://suffandnonsense.blogspot.com/2007/05/easy-web-services-with-ez-publish.html

i've been using the ezxmldesign extension here:
http://zev.ez.no/svn/extensions/ezxmldesign/trunk/extension/ezxmldesign/

just add a siteaccess which uses the 'xml' design in the extension to output stuff like:

<?xml version="1.0" encoding="utf-8"?>
<ez:content xmlns:ez="http://ez.no/ez" xmlns:ez="http://ez.no/ez"
            xmlns="http://ez.no/">
  <ez:node xmlns:ez="http://ez.no/ez" view="full">
    <ez:name xmlns:ez="http://ez.no/ez">Home</ez:name>
    <ez:attribute xmlns:ez="http://ez.no/ez" name="ezstring"
                  identifier="name"
                  classidentifier="folder">
      <ez:text xmlns:ez="http://ez.no/ez">Home</ez:text>
    </ez:attribute>
    <ez:attribute xmlns:ez="http://ez.no/ez" name="ezboolean"
                  identifier="show_children"
                  classidentifier="folder">
      <ez:boolean xmlns:ez="http://ez.no/ez">Yes</ez:boolean>

    </ez:attribute>
  </ez:node>
</ez:content>

then you can override the templates to your heart's content.

Paul Wilson

Wednesday 30 May 2007 6:12:07 pm

Excellent! Thanks Stevo.

That looks great. I'd only spotted old and incompleted methods when I searched the forums.

Paul Wilson

Thursday 14 June 2007 12:02:28 am

A follow-up note for fellow EZ travellers.

I've been learning more about EZ's nifty features and benefits... I've now figured out how to do all of this using ez's php modules, includes and related code. It still takes some working out, but it does not make any sense to do this the way I first suggested. The EZ code takes all of the hard work out of it. Can be done with 5-10 lines of code instead of 40 or 50.

Softriva .com

Tuesday 26 June 2007 9:02:09 am

Paul,

Can you post your code?

I need to generate xml data for an ajax timeline to read. http://simile.mit.edu/timeline/

http://ez.no/community/forum/setup_design/javascript_timeline_xml_and_ez_publish

I am really stuck. Andre from eZ crew tried to help me and I thank him but I am still not sure how to do it.

OOzy

Paul Wilson

Tuesday 26 June 2007 5:53:42 pm

Hi Oozy,

This code is a bit long ... will send to you rather than posting. It is for simile timeline and produces the XML files required. I've created custom EZ object classes for the timeline components. Still a work in progress. I'd planned to turn this into an EZ extension.

Regards

- Paul

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.