/usr/share/doc/php-horde-rdo/examples/DumpXmlTest.php is in php-horde-rdo 2.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <?php
/**
* @package Rdo
*/
require_once './Clotho.php';
class XmlItemMapper extends ItemMapper
{
}
class XmlItem extends Item
{
/**
* Return an XML representation of this object. The default
* implementation is unlikely to be useful in most cases and
* should be overridden by subclasses to be domain-appropriate.
*
* @TODO: see http://pear.php.net/pepr/pepr-proposal-show.php?id=361 ?
*
* @return string XML representation of $this.
*/
public function toXml()
{
$doc = new DOMDocument('1.0');
$root = $doc->appendChild($doc->createElement(get_class($this)));
foreach ($this as $field => $value) {
$f = $root->appendChild($doc->createElement($field));
$f->appendChild($doc->createTextNode($value));
}
return $doc->saveXML();
}
}
$im = new XmlItemMapper($conf['adapter']);
$i = $im->findOne(1);
echo $i->toXml();
|