src/XQueue/Maileon/API/Contacts/Contacts.php
function toXML()
    {
        $xml = new SimpleXMLElement("<?xml version=\"1.0\"?><contacts></contacts>");
        $contactsDom = dom_import_simplexml($xml);

        foreach ($this->contacts as $contact) {
            $contactDom = dom_import_simplexml($contact->toXML(false));
            $contactsDom->appendChild($contactsDom->ownerDocument->importNode($contactDom, true));
        }

        return new SimpleXMLElement($contactsDom->ownerDocument->saveXML());
    }
function toXML()
    {
        $xml = new SimpleXMLElement("<?xml version=\"1.0\"?><contacts></contacts>");
        $contactsDom = dom_import_simplexml($xml);

        foreach ($this->contacts as $contact) {
            $contactDom = dom_import_simplexml($contact->toXML(false));
            $contactsDom->appendChild($contactsDom->ownerDocument->importNode($contactDom, true));
        }

        return new SimpleXMLElement($contactsDom->ownerDocument->saveXML());
    }
Serialization to a simple XML element.

@return \em SimpleXMLElement
Generate a XML element from the contact object.