19 declare(strict_types=1);
31 $this->processors = $processor;
40 foreach ($this->processors as $p) {
53 foreach ($this->processors as $processor) {
54 $processor->beginComponent($component, $type);
57 foreach ($this->processors as $processor) {
58 $processor->endComponent($component, $type);
65 if (!file_exists($path)) {
66 throw new \InvalidArgumentException(
67 "Cannot find file $path." 70 return file_get_contents($path);
77 $xml_parser = xml_parser_create(
"UTF-8");
78 xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,
false);
79 xml_set_element_handler($xml_parser, $this->
beginTag(...), $this->
endTag(...));
80 if (!xml_parse($xml_parser, $xml)) {
81 $code = xml_get_error_code($xml_parser);
82 $line = xml_get_current_line_number($xml_parser);
83 $col = xml_get_current_column_number($xml_parser);
84 $msg = xml_error_string($code);
85 throw new \InvalidArgumentException(
86 "Error $code component xml of $type/$component, on line $line in column $col: $msg" 91 xml_parser_free($xml_parser);
96 public function beginTag($_,
string $name, array $attributes): void
98 foreach ($this->processors as $processor) {
99 $processor->beginTag($name, $attributes);
103 public function endTag($_,
string $name): void
105 foreach ($this->processors as $processor) {
106 $processor->endTag($name);
118 foreach ($this->
getComponentInfo(
"components/ILIAS",
"service.xml") as $i) {
128 $dir = __DIR__ .
"/../../../../" . $type;
133 realpath($dir .
"/" . $c .
"/" . $name)
143 $dir = opendir($root);
144 while ($sub = readdir($dir)) {
145 if ($sub ===
"." || $sub ===
"..") {
148 if (!is_dir($root .
"/" . $sub)) {
151 if (!is_file($root .
"/" . $sub .
"/" . $name)) {
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i.e.
purge()
This methods is supposed to purge existing data in the registered processor.
parseComponentXML(string $type, string $component, string $xml)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getComponentInfo(string $type, string $name)
getComponentPaths(string $root, string $name)
readComponentDefinitions()
This reads the component.xml of all components in the core and processes them with the provided proce...
beginTag($_, string $name, array $attributes)
__construct(ilComponentDefinitionProcessor ... $processor)