FrxXMLDoc.inc 921 Bytes
Newer Older
metzlerd's avatar
??    
metzlerd committed
1
2
3
4
5
6
7
8
<?php
/**
 * @file FrxHtmlDoc
 * Straight XML document with no wrapping theme.
 * @author davidmetzler
 *
 */
class FrxXMLDoc extends FrxDocument {
metzlerd's avatar
metzlerd committed
9
  public $root_tag = 'div';
metzlerd's avatar
??    
metzlerd committed
10
11
12

  public function __construct() {
    $this->content_type = 'application/xml';
metzlerd's avatar
metzlerd committed
13
14
15
16
    $skin = Frx::Data()->getContext('skin');
    if (isset($skin['FrxXMLDoc']['rootElementName'])) {
      $this->root_tag = $skin['FrxXMLDoc']['rootElementName'];
    }
metzlerd's avatar
??    
metzlerd committed
17
18
19
20
  }

  public function render($r, $format, $options = array()) {
    $body = $this->check_markup($r->html);
metzlerd's avatar
metzlerd committed
21
    $tag = $this->root_tag;
metzlerd's avatar
??    
metzlerd committed
22
    $output = '<?xml version="1.0"?>' . "\n";
metzlerd's avatar
metzlerd committed
23
    $output .= "<$tag>\n  $body\n</$tag>";
metzlerd's avatar
??    
metzlerd committed
24
25
26
27
28
29
30
31
32
33
34
    return $output;
  }

  public function output($output) {
      header('Content-Type: ' . $this->content_type);
      header('Cache-Control:');
      header('Pragma:');
      header('Cache-Control: must-revalidate');
      print  $output;
      return TRUE;
      }
metzlerd's avatar
metzlerd committed
35
}