- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/xml.php
- Класс: CXMLFileStream
- Вызов: CXMLFileStream::findNext
public function findNext()
{
$cs = $this->fileCharset;
if ($this->fileHandler === null)
return false;
$this->eof = false;
while (($xmlChunk = $this->getXmlChunk()) !== false)
{
$origChunk = $xmlChunk;
if ($cs)
{
$xmlChunk = Encoding::convertEncoding($origChunk, $cs, LANG_CHARSET);
}
if ($xmlChunk[0] == "/")
{
$this->endElement();
return true;
}
elseif ($xmlChunk[0] == "!" || $xmlChunk[0] == "?")
{
if (mb_substr($xmlChunk, 0, 4) === "?xml")
{
if (preg_match('#encodings*=s*"(.*?)"#i', $xmlChunk, $arMatch))
{
$this->fileCharset = $arMatch[1];
if (mb_strtoupper($this->fileCharset) === mb_strtoupper(LANG_CHARSET))
{
$this->fileCharset = false;
}
$cs = $this->fileCharset;
}
}
}
else
{
$this->startElement($xmlChunk, $origChunk);
//check for self-closing tag
$p = mb_strpos($xmlChunk, ">");
if (($p !== false) && (mb_substr($xmlChunk, $p - 1, 1) == "/"))
{
$this->endElement();
return true;
}
}
}
$this->eof = true;
return false;
}