neviem ci robim nieco zle, ale potreboval som nacitavat XML z premennej namiesto suboru. Nevedel som to cez $pohoda->load tak som si rozsiril classu o tuto funkciu. Robim to zbytocne a slo to aj bez toho alebo sa s nacitanim XML z premennej/stringu neratalo?
use Riesenia\Pohoda;
class PohodaString extends Pohoda
{
/**
* Load XML string.
*
* @param string $name
* @param string $xmlstring
*
* @return bool
*/
public function loadString(string $name, string $xmlstring)
{
$this->_xmlReader = new \XMLReader();
if (!$this->_xmlReader->XML($xmlstring)) {
return false;
}
$fullName = 'Riesenia\\Pohoda\\' . $name;
if (!\class_exists($fullName)) {
throw new \DomainException('Not allowed entity: ' . $name);
}
while ($this->_xmlReader->read() && $this->_xmlReader->name !== $fullName::$importRoot) {
// skip to first element
}
return true;
}
}
Zdravim,
neviem ci robim nieco zle, ale potreboval som nacitavat XML z premennej namiesto suboru. Nevedel som to cez
$pohoda->load
tak som si rozsiril classu o tuto funkciu. Robim to zbytocne a slo to aj bez toho alebo sa s nacitanim XML z premennej/stringu neratalo?