• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/xml.php
  • Класс: CDataXML
  • Вызов: CDataXML::__toString
function __toString()
{
	switch ($this->name)
	{
		case "cdata-section":
			$ret = "content;
			$ret .= "]]>";
			break;

		default:
			$isOneLiner = false;

			if (empty($this->children) && $this->content == '')
				$isOneLiner = true;

			$attrStr = "";

			if (is_array($this->attributes))
			{
				foreach ($this->attributes as $attr)
				{
					$attrStr .= " ".$attr->name."="".CDataXML::xmlspecialchars($attr->content)."" ";
				}
			}

			if ($isOneLiner)
				$oneLinerEnd = " /";
			else
				$oneLinerEnd = "";

			$ret = "<".$this->name.$attrStr.$oneLinerEnd.">";

			if (is_array($this->children))
			{
				foreach ($this->children as $child)
				{
					$ret .= $child->__toString();
				}
			}

			if (!$isOneLiner)
			{
				if ($this->content <> '')
					$ret .= CDataXML::xmlspecialchars($this->content);

				$ret .= "name.">";
			}

			break;
	}

	return $ret;
}