コード例 #1
0
 /**
  * @dataProvider getEzXmlTestDocuments
  */
 public function testConvertToDocbook($from, $to)
 {
     if (!is_file($to)) {
         $this->markTestSkipped("Comparision file '{$to}' not yet defined.");
     }
     $document = new ezcDocumentEzXml();
     $document->loadFile($from);
     $docbook = $document->getAsDocbook();
     $xml = $docbook->save();
     $this->assertTrue($docbook instanceof ezcDocumentDocbook);
     // Store test file, to have something to compare on failure
     $tempDir = $this->createTempDir('ezxml_docbook_') . '/';
     file_put_contents($tempDir . basename($to), $xml);
     // We need a proper XSD first, the current one does not accept legal
     // XML.
     //        $this->checkDocbook( $docbook->getDomDocument() );
     $this->assertEquals(file_get_contents($to), $xml, 'Document not visited as expected.');
     // Remove tempdir, when nothing failed.
     $this->removeTempDir();
 }
コード例 #2
0
<?php

require 'tutorial_autoload.php';
$document = new ezcDocumentEzXml();
$document->loadString('<?xml version="1.0"?>
<section xmlns="http://ez.no/namespaces/ezpublish3">
    <header>Paragraph</header>
    <paragraph>Some content...</paragraph>
</section>');
$docbook = $document->getAsDocbook();
echo $docbook->save();