src/XQueue/Maileon/API/Mailings/Mailing.php
function toXML($addXMLDeclaration = true)
    {
        $xmlString = $addXMLDeclaration ? "<?xml version=\"1.0\"?><mailing></mailing>" : "<mailing></mailing>";
        $xml = new SimpleXMLElement($xmlString);

        if (isset($this->id)) $xml->addChild("id", $this->id);

        if (isset($this->fields)) {
            $standard_fields = $xml->addChild("fields");
            foreach ($this->fields as $index => $value) {
                $field = $standard_fields->addChild("field");
                $field->addChild("name", $index);

                XMLUtils::addChildAsCDATA($field, "value", $value);
            }
        }

        return $xml;
    }
function toXML($addXMLDeclaration = true)
    {
        $xmlString = $addXMLDeclaration ? "<?xml version=\"1.0\"?><mailing></mailing>" : "<mailing></mailing>";
        $xml = new SimpleXMLElement($xmlString);

        if (isset($this->id)) $xml->addChild("id", $this->id);

        if (isset($this->fields)) {
            $standard_fields = $xml->addChild("fields");
            foreach ($this->fields as $index => $value) {
                $field = $standard_fields->addChild("field");
                $field->addChild("name", $index);

                XMLUtils::addChildAsCDATA($field, "value", $value);
            }
        }

        return $xml;
    }
Serialization to a simple XML element.

@param bool $addXMLDeclaration

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