Horde_Kolab_Format_Xml::save PHP Méthode

save() public méthode

Convert the data to a XML stream. Strings contained in the data array may only be provided as UTF-8 data.
public save ( array $object, array $options = [] ) : string
$object array The data array representing the object.
$options array Additional options when writing the XML.
- previous: The previous XML text (default: empty string)
- relaxed: Relaxed error checking (default: false)
Résultat string The data as an XML string.
    public function save($object, $options = array())
    {
        if (!isset($options['previous'])) {
            $this->_xmldoc = $this->_getParser()->getDocument();
        } else {
            $parse_options = $options;
            unset($parse_options['previous']);
            $this->_xmldoc = $this->_getParser()->parse($options['previous'], $parse_options);
        }
        $this->_refreshParser();
        $params = $this->_getParameters($options);
        $this->_getRoot($params)->save($this->_root_name, $object, $this->_xmldoc, $this->_factory->createXmlHelper($this->_xmldoc), $params);
        return $this->_xmldoc->saveXML();
    }

Usage Example

Exemple #1
0
 public function testRoundtripWithPreviousOnApiV1()
 {
     $xml = new Horde_Kolab_Format_Xml(new Horde_Kolab_Format_Xml_Parser(new DOMDocument('1.0', 'UTF-8')), new Horde_Kolab_Format_Factory(), array('version' => 1));
     $first = $xml->save(array('uid' => 1));
     $second = $xml->save($xml->load($first));
     $this->assertEquals($this->removeLastModification($first), $this->removeLastModification($second));
 }
All Usage Examples Of Horde_Kolab_Format_Xml::save