19declare(strict_types=1);
58 $root_name = $root->getDefinition()->name();
59 $xml = new \SimpleXMLElement(
'<' . $root_name .
'></' . $root_name .
'>');
76 if (!$this->copyright_handler->isCopyrightSelectionActive()) {
80 $path_to_copyright = $this->path_factory->custom()
81 ->withNextStep(
'rights')
82 ->withNextStep(
'description')
83 ->withNextStep(
'string')
86 return $this->manipulator->prepareCreateOrUpdate($set, $path_to_copyright,
'');
92 \SimpleXMLElement $xml,
96 throw new \ilMDXMLException(
'LOM set is nested too deep.');
99 if ($tag?->isExportedAsLangString()) {
104 foreach ($element->getSubElements() as $sub_element) {
106 $sub_name = $sub_element->getDefinition()->name();
107 $sub_value = $this->
getDataValue($sub_element->getData(), $sub_tag);
109 if ($sub_tag?->isOmitted()) {
113 if ($sub_tag?->isExportedAsAttribute()) {
114 $xml->addAttribute($sub_name, (
string) $sub_value);
118 $child_xml = $xml->addChild($sub_name);
119 $child_xml[0] = $sub_value;
126 \SimpleXMLElement $xml
128 $string_element = null;
129 $language_element =
null;
131 if ($sub_element->getDefinition()->name() ===
'string') {
132 $string_element = $sub_element;
133 } elseif ($sub_element->getDefinition()->name() ===
'language') {
134 $language_element = $sub_element;
139 if (!is_null($string_element)) {
140 $string_value = $this->getDataValue(
141 $string_element->getData(),
142 $this->getTagForElement($string_element)
145 $string_xml = $xml->addChild(
'string');
146 $xml->string = $string_value;
148 if (is_null($language_element)) {
151 $language_value = $this->getDataValue(
152 $language_element->getData(),
153 $this->getTagForElement($language_element)
155 $string_xml->addAttribute(
165 if ($tag?->isTranslatedAsCopyright()) {
166 return $this->copyright_handler->copyrightForExport(
$data->value());
169 switch (
$data->type()) {
174 $value =
$data->value();
175 if ($value ===
'xx') {
181 case Type::VOCAB_SOURCE:
182 case Type::VOCAB_VALUE:
184 case Type::NON_NEG_INT:
187 return $data->value();
193 return $this->dictionary->tagForElement($element, $this->currentVersion());
if(!file_exists('../ilias.ini.php'))