public function referenceItemsStart($path, $attr) { if ($this->NS["fp"] <= 0) { $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 10)); } else { $this->deleteBySessid($this->NS["HL"], $this->NS["SESSID"]); $xmlPosition = $this->xmlStream->getPosition(); $filePosition = $this->decodePostion($xmlPosition); $xmlString = $this->xmlStream->readFilePart($this->NS["fp"], $filePosition); $error = ""; if ($xmlPosition[0]) { $xmlString = CharsetConverter::convertCharset($xmlString, $xmlPosition[0], LANG_CHARSET, $error); } $xmlString .= "</" . GetMessage("CC_BCIH_XML_REFERENCE") . ">"; $xmlObject = new CDataXML(); if ($xmlObject->loadString($xmlString)) { $highBlockID = $this->checkReference($xmlObject->GetArray()); $this->dataClass = ""; $this->step = true; $this->message = GetMessage("CC_BCIH_REFERENCE_FOUND_OR_CREATED", array("#CODE#" => $highBlockID)); if ($highBlockID > 0) { $this->NS["HL"] = $highBlockID; $this->NS["FM"] = array(); $this->NS["C"] = 0; } else { $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 30)); } } else { $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 20)); } } }
/** * Reads xml chunk from the file preserving it's position * * @param int $startPosition * @param int $endPosition * @return CDataXML|false */ private function readXml($startPosition, $endPosition) { $savedPosition = ftell($this->fileHandler); fseek($this->fileHandler, $startPosition); $xmlChunk = fread($this->fileHandler, $endPosition - $startPosition); fseek($this->fileHandler, $savedPosition); if ($xmlChunk && $this->fileCharset) { $error = ""; $xmlChunk = CharsetConverter::convertCharset($xmlChunk, $this->fileCharset, LANG_CHARSET, $error); } $xmlObject = new CDataXML(); if ($xmlObject->loadString($xmlChunk)) { return $xmlObject; } else { return false; } }
/** * Reads xml chunk from the file preserving it's position * * @param int $startPosition * @param int $endPosition * @return CDataXML|false */ private function readXml($startPosition, $endPosition) { $xmlChunk = $this->readFilePart($startPosition, $endPosition); if ($xmlChunk && $this->fileCharset) { $error = ""; $xmlChunk = CharsetConverter::convertCharset($xmlChunk, $this->fileCharset, LANG_CHARSET, $error); } $xmlObject = new CDataXML(); if ($xmlObject->loadString($xmlChunk)) { return $xmlObject; } else { return false; } }