Forums / Install & configuration / ez : xml to html

ez : xml to html

Author Message

Fred Gueho

Monday 24 April 2006 8:38:36 am

Hi all,

With PHP, I get some xml content in the database.

And I need to ouput this content in html (the ezpublish xml tags are not all html tags).
Are there any php ezpublish objects or function I can use to do so ?

Like (it's a fake example) :

include_once("lib/ezdb/classes/ezxml2html.php");
$xml2html =& eZXML2HTML::instance();
$ouput =& $xml2html->getHtml($myXml);

I'm sure there are premade objects I can use, but I just can't find them.

Thanks for your help.

Gabriel Ambuehl

Monday 24 April 2006 11:38:46 am

There's handlers for that in the kernel.

I think http://pubsvn.ez.no/doxygen/classeZXMLTextType.html#a15 could be the interface for it.

Visit http://triligon.org

Fred Gueho

Monday 24 April 2006 2:01:15 pm

Hi,

Thanks for your help.

What I need is the object/function that output XHTML format (from xml content object).

Example :
it will take an ezXml object like :

<header>This is a level one header</header>
<paragraph>This is a <emphasize>block</emphasize> of text.</paragraph>

and output it in xhtml :

<h1>This is a level one header</h1>
<p>This is a <em>block</em> of text.</p>

What object/function should I use ?

Kirill Subbotin

Tuesday 25 April 2006 12:43:53 am

Here is a simple example:

include_once('kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php');

$XMLContent = "<section><paragraph>text</paragraph></section>";

$outputHandler = new eZXHTMLXMLOutput( $XMLContent, false, $contentObjectAttribute );

$htmlContent =& $outputHandler->outputText();

I didn't test it, but this should work.

ps. Object attribute is needed here, but probably you can skip this by modifying handler's code, it is not so very much used there.

Fred Gueho

Tuesday 25 April 2006 2:04:32 am

Thank you !!! I think it is exactly what I need !

Is there any documentation about this object ?

Thanks for your help.

Fred

Kirill Subbotin

Tuesday 25 April 2006 2:14:53 am

There are no docs, unfortunately, the only doc is the source code. But it is pretty obvious to use, I think.

Fred Gueho

Tuesday 25 April 2006 3:11:48 am

Well, I don't need the doc for this particular object but I have done extensive search in http://pubsvn.ez.no/doxygen to find the right object to output XHTML and I haven't found it. Because it's not there !

So I'm a bit disapointed by this documentation that doesn't provide all the API.

And I was asking if there was a place where ALL the objects were documented. So that I can find what I need by myself without bothering you and the forum :)

Thanks.

Fred

Fred Gueho

Tuesday 25 April 2006 5:24:36 am

Well, thank you Kirill, it works as expected. Exactly what I needed !

:)

nehal shah

Saturday 05 February 2011 2:54:46 am

Thanx Kirill.

This example is very useful. I want exactly this type of output and searching for many days.But finally i saw your example and tried it.This works fine.

Thanx again

eZ debug

Timing: Jan 17 2025 23:36:26
Script start
Timing: Jan 17 2025 23:36:26
Module start 'content'
Timing: Jan 17 2025 23:36:27
Module end 'content'
Timing: Jan 17 2025 23:36:27
Script end

Main resources:

Total runtime0.9861 sec
Peak memory usage4,096.0000 KB
Database Queries216

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.7031180.8438
Module start 'content' 0.00510.8652 768.5469638.6094
Module end 'content' 0.87030.1156 1,407.1563341.1641
Script end 0.9859  1,748.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3832210.0002
Check MTime0.00150.1493210.0001
Mysql Total
Database connection0.00070.070810.0007
Mysqli_queries0.915492.83842160.0042
Looping result0.00200.19892140.0000
Template Total0.960297.420.4801
Template load0.00210.211120.0010
Template processing0.958197.168820.4791
Template load and register function0.00020.021510.0002
states
state_id_array0.00110.110110.0011
state_identifier_array0.00110.110320.0005
Override
Cache load0.00180.1874530.0000
Sytem overhead
Fetch class attribute can translate value0.00130.136650.0003
Fetch class attribute name0.00100.103690.0001
XML
Image XML parsing0.00090.086850.0002
class_abstraction
Instantiating content class attribute0.00000.001590.0000
General
dbfile0.00310.3183210.0001
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs