public function __toString() { //if the input was HTML, remove the XML prolog on output return $this->type == self::HTML ? preg_replace('/^<\\?xml[^<]*>\\n/', '', parent::__toString()) : parent::__toString(); }