/**
  * Write the function block XML
  *
  * @param XMLWriter $xml
  * @throws InvalidArgumentException
  * @todo Validate the app.xml is actually a platform app
  */
 public function writeXml(XMLWriter &$xml)
 {
     $xml->startElement('function');
     $xml->writeAttribute('controlid', $this->getControlId());
     $xml->startElement('installApp');
     $xml->startElement('appxml');
     if (!$this->getXmlFilename()) {
         throw new InvalidArgumentException('XML Filename is required for install');
     }
     if (!is_readable($this->getXmlFilename())) {
         throw new InvalidArgumentException('XML Filename is not readable for install');
     }
     $xml->writeCdata(file_get_contents($this->getXmlFilename()));
     $xml->endElement();
     //appxml
     $xml->endElement();
     //installApp
     $xml->endElement();
     //function
 }