/** * Return document compiled to the docbook format * * The internal document structure is compiled to the docbook format and * the resulting docbook document is returned. * * This method is required for all formats to have one central format, so * that each format can be compiled into each other format using docbook as * an intermediate format. * * You may of course just call an existing converter for this conversion. * * @return ezcDocumentDocbook */ public function getAsDocbook() { $converter = new ezcDocumentEzXmlToDocbookConverter(); $converter->options->errorReporting = $this->options->errorReporting; $document = $converter->convert($this); $document->setPath($this->path); return $document; }
/** * Return document compiled to the docbook format * * The internal document structure is compiled to the docbook format and * the resulting docbook document is returned. * * This method is required for all formats to have one central format, so * that each format can be compiled into each other format using docbook as * an intermediate format. * * You may of course just call an existing converter for this conversion. * * @return ezcDocumentDocbook */ public function getAsDocbook() { $converter = new ezcDocumentEzXmlToDocbookConverter(); $converter->options->errorReporting = $this->options->errorReporting; return $converter->convert($this); }
<?php require 'tutorial_autoload.php'; class myLinkProvider extends ezcDocumentEzXmlLinkProvider { public function fetchUrlById($id, $view, $show_path) { return 'http://host/path/' . $id; } public function fetchUrlByNodeId($id, $view, $show_path) { } public function fetchUrlByObjectId($id, $view, $show_path) { } } $document = new ezcDocumentEzXml(); $document->loadString('<?xml version="1.0"?> <section xmlns="http://ez.no/namespaces/ezpublish3"> <header>Paragraph</header> <paragraph>Some content, with a <link url_id="1">link</link>.</paragraph> </section>'); // Set link provider $converter = new ezcDocumentEzXmlToDocbookConverter(); $converter->options->linkProvider = new myLinkProvider(); $docbook = $converter->convert($document); echo $docbook->save();