- Модуль: webservice
- Путь к файлу: ~/bitrix/modules/webservice/classes/general/xmlcreator.php
- Класс: CXMLCreator
- Вызов: CXMLCreator::createTagAttributed
static function createTagAttributed($heavyTag, $value = null)
{
$heavyTag = trim($heavyTag);
$name = $heavyTag;
$attrs = 0;
$attrsPos = mb_strpos($heavyTag, " ");
if ($attrsPos)
{
$name = mb_substr($heavyTag, 0, $attrsPos);
$attrs = mb_strstr(trim($heavyTag), " ");
}
if (!trim($name)) return false;
$nameSplited = explode(":", $name);
if ($nameSplited)
$name = $nameSplited[count($nameSplited) - 1];
$name = CDataXML::xmlspecialcharsback($name);
$node = new CXMLCreator( $name );
if ($attrs and mb_strlen($attrs))
{
$attrsSplit = explode(""", $attrs);
$i = 0;
while ($validi = mb_strpos(trim($attrsSplit[$i]), "="))
{
$attrsSplit[$i] = trim($attrsSplit[$i]);
// attr:ns=
$attrName = CDataXML::xmlspecialcharsback(mb_substr($attrsSplit[$i], 0, $validi));
// attrs:ns
$attrValue = CDataXML::xmlspecialcharsback($attrsSplit[$i+1]);
$node->setAttribute($attrName, $attrValue);
$i = $i + 2;
}
}
if (null !== $value)
$node->setData($value);
return $node;
}