Forums / General / XML Output of EZ content - A Method

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

eZ debug

Timing: Jan 31 2025 06:17:18
Script start
Timing: Jan 31 2025 06:17:18
Module start 'content'
Timing: Jan 31 2025 06:17:18
Module end 'content'
Timing: Jan 31 2025 06:17:18
Script end

Main resources:

Total runtime0.2815 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0106 587.9297180.8359
Module start 'content' 0.01060.0075 768.7656101.9766
Module end 'content' 0.01810.2633 870.7422531.2969
Script end 0.2814  1,402.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00371.3274200.0002
Check MTime0.00150.5162200.0001
Mysql Total
Database connection0.00160.580110.0016
Mysqli_queries0.228081.00511410.0016
Looping result0.00130.47121390.0000
Template Total0.262793.310.2627
Template load0.00090.333610.0009
Template processing0.261792.974910.2617
Override
Cache load0.00060.227010.0006
Sytem overhead
Fetch class attribute can translate value0.00080.280910.0008
XML
Image XML parsing0.00020.077110.0002
General
dbfile0.00953.3816200.0005
String conversion0.00000.004030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs