fetch(PDO::FETCH_ASSOC); $meta_node = $outputObj->addChild($cur_record ,"metadata"); $schema_node = $outputObj->addChild($meta_node, 'oai_dc:dc'); $schema_node->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); $schema_node->setAttribute('xmlns:dc',"http://purl.org/dc/elements/1.1/"); $schema_node->setAttribute('xmlns:xsi',"http://www.w3.org/2001/XMLSchema-instance"); $schema_node->setAttribute('xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'); foreach ($record as $r => $v) { if (!empty($v)) { $outputObj->addChild($schema_node, str_replace('_', ':', $r), $v); } } }