19 declare(strict_types=1);
38 if ([] === $this->errorStack) {
39 $this->xmlErrorState = libxml_use_internal_errors(
true);
40 libxml_clear_errors();
45 $this->errorStack[] = [];
50 $currentErrors = libxml_get_errors();
51 libxml_clear_errors();
53 $level = count($this->errorStack) - 1;
54 $this->errorStack[$level] = array_merge($this->errorStack[$level], $currentErrors);
64 $errors = array_pop($this->errorStack);
66 if ([] === $this->errorStack) {
67 libxml_use_internal_errors($this->xmlErrorState);
73 public function parse(
string $xmlString): void
81 $this->
result = $this->dataFactory->ok($xmlString);
84 $this->
result = $this->dataFactory->error(implode(
88 'level=' . $error->level,
89 'code=' . $error->code,
90 'line=' . $error->line,
91 'col=' . $error->column,
92 'msg=' . trim($error->message)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private readonly DataTypeFactory $dataFactory)