]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/xmloutputter.php
Styles for group block
[quix0rs-gnu-social.git] / lib / xmloutputter.php
index 9a7d12e4c93e1b5fa438ef56b0a4b1378b83f9c2..64935da4081b6b5e63d21efaefdfe888c7cdd93d 100644 (file)
@@ -63,8 +63,8 @@ class XMLOutputter
      *
      * Initializes the wrapped XMLWriter.
      *
-     * @param $output URL for outputting, defaults to stdout
-     * @param $indent Whether to indent output, default true
+     * @param string  $output URL for outputting, defaults to stdout
+     * @param boolean $indent Whether to indent output, default true
      */
 
     function __construct($output='php://output', $indent=true)
@@ -72,7 +72,6 @@ class XMLOutputter
         $this->xw = new XMLWriter();
         $this->xw->openURI($output);
         $this->xw->setIndent($indent);
-        $this->xw->startDocument('1.0', 'UTF-8');
     }
 
     /**
@@ -87,6 +86,7 @@ class XMLOutputter
 
     function startXML($doc=null, $public=null, $system=null)
     {
+        $this->xw->startDocument('1.0', 'UTF-8');
         if ($doc) {
             $this->xw->writeDTD($doc, $public, $system);
         }
@@ -119,6 +119,9 @@ class XMLOutputter
      * raw output, use elementStart() and elementEnd() with a call
      * to raw() in the middle.
      *
+     * If $attrs is a string instead of an array, it will be treated
+     * as the class attribute of the element.
+     *
      * @param string $tag     Element type or tagname
      * @param array  $attrs   Array of element attributes, as
      *                        key-value pairs
@@ -142,6 +145,9 @@ class XMLOutputter
      * Mostly used for when an element has content that's
      * not a simple string.
      *
+     * If $attrs is a string instead of an array, it will be treated
+     * as the class attribute of the element.
+     *
      * @param string $tag   Element type or tagname
      * @param array  $attrs Array of element attributes
      *
@@ -220,4 +226,17 @@ class XMLOutputter
     {
         $this->xw->writeRaw($xml);
     }
+
+    /**
+     * output a comment
+     *
+     * @param string $txt text of the comment
+     *
+     * @return void
+     */
+
+    function comment($txt)
+    {
+        $this->xw->writeComment($txt);
+    }
 }