function toXML(&$writer)
 {
     if ($this->getMetaDataScheme()) {
         $attr['MetadataScheme'] = $this->getMetaDataScheme();
     }
     if ($this->getLanguageCode()) {
         $attr['Language'] = $this->getLanguageCode();
     }
     $writer->xmlStartTag('Meta-Metadata', $attr ? $attr : null);
     // ELEMENT IDENTIFIER
     $identifiers = $this->getIdentifierIds();
     foreach ($identifiers as $id) {
         $ide =& $this->getIdentifier($id);
         $ide->toXML($writer);
     }
     if (!count($identifiers)) {
         include_once 'Services/Metadata/classes/class.ilMDIdentifier.php';
         $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId());
         $ide->toXML($writer);
     }
     // ELEMETN Contribute
     $contributes = $this->getContributeIds();
     foreach ($contributes as $id) {
         $con =& $this->getContribute($id);
         $con->toXML($writer);
     }
     if (!count($contributes)) {
         include_once 'Services/MetaData/classes/class.ilMDContribute.php';
         $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
         $con->toXML($writer);
     }
     $writer->xmlEndTag('Meta-Metadata');
 }
 function toXML(&$writer)
 {
     $writer->xmlStartTag('General', array('Structure' => $this->getStructure() ? $this->getStructure() : 'Atomic'));
     // Identifier
     $first = true;
     $identifiers = array();
     $identifiers = $this->getIdentifierIds();
     foreach ($identifiers as $id) {
         $ide =& $this->getIdentifier($id);
         $ide->setExportMode($this->getExportMode());
         $ide->toXML($writer);
         $first = false;
     }
     if (!count($identifiers)) {
         include_once 'Services/MetaData/classes/class.ilMDIdentifier.php';
         $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
         // added type, alex, 31 Oct 2007
         $ide->setExportMode(true);
         $ide->toXML($writer, true);
     }
     // Title
     $writer->xmlElement('Title', array('Language' => $this->getTitleLanguageCode() ? $this->getTitleLanguageCode() : 'en'), $this->getTitle());
     // Language
     $languages = $this->getLanguageIds();
     foreach ($languages as $id) {
         $lan =& $this->getLanguage($id);
         $lan->toXML($writer);
     }
     if (!count($languages)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDLanguage.php';
         $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId());
         $lan->toXML($writer);
     }
     // Description
     $descriptions = $this->getDescriptionIds();
     foreach ($descriptions as $id) {
         $des =& $this->getDescription($id);
         $des->toXML($writer);
     }
     if (!count($descriptions)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDDescription.php';
         $des = new ilMDDescription($this->getRBACId(), $this->getObjId());
         $des->toXML($writer);
     }
     // Keyword
     $keywords = $this->getKeywordIds();
     foreach ($keywords as $id) {
         $key =& $this->getKeyword($id);
         $key->toXML($writer);
     }
     if (!count($keywords)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDKeyword.php';
         $key = new ilMDKeyword($this->getRBACId(), $this->getObjId());
         $key->toXML($writer);
     }
     // Copverage
     if (strlen($this->getCoverage())) {
         $writer->xmlElement('Coverage', array('Language' => $this->getCoverageLanguageCode() ? $this->getCoverageLanguageCode() : 'en'), $this->getCoverage());
     }
     $writer->xmlEndTag('General');
 }