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.

eZ debug

Timing: Jan 31 2025 03:30:45
Script start
Timing: Jan 31 2025 03:30:45
Module start 'layout'
Timing: Jan 31 2025 03:30:45
Module start 'content'
Timing: Jan 31 2025 03:30:46
Module end 'content'
Timing: Jan 31 2025 03:30:46
Script end

Main resources:

Total runtime1.0936 sec
Peak memory usage8,192.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.1328151.2109
Module start 'layout' 0.00510.0039 739.3438220.6875
Module start 'content' 0.00901.0838 960.03134,496.3984
Module end 'content' 1.09280.0007 5,456.429715.8438
Script end 1.0935  5,472.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3183160.0002
Check MTime0.00120.1118160.0001
Mysql Total
Database connection0.00070.068210.0007
Mysqli_queries0.983289.9047680.0145
Looping result0.00070.0661660.0000
Template Total1.036494.820.5182
Template load0.00190.171920.0009
Template processing1.034594.600320.5173
Template load and register function0.00170.158010.0017
states
state_id_array0.00190.171610.0019
state_identifier_array0.00170.153620.0008
Override
Cache load0.00170.1517460.0000
Sytem overhead
Fetch class attribute can translate value0.00230.206030.0008
Fetch class attribute name0.00250.225280.0003
XML
Image XML parsing0.00460.417230.0015
class_abstraction
Instantiating content class attribute0.00000.0026110.0000
General
dbfile0.00530.4843210.0003
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs