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