I have protected function with php-code:
$replaceData = array(
        '%userName%' => $order->getUserFullName(),
        '%userEmail%' => $order->getUserEmail(),
        '%userPhone%' => $order->getUserPhone(),
        '%userDeliver%' => $order->getUserDeliverTo(),
        '%orderId%' => $order->getId(),
        '%orderKey%' => $order->getKey(),
        '%orderLink%' => shop_url('cart/view/' . $order->getKey()),
    );
How to save this array to xml-file using simpleXML?
 
    