EnumerateResources($rootId, -1, 'MapDefinition'); //make a list of maps to query for names $mapListXml = DOMDocument::loadXML(ByteReaderToString($maps)); //$aMapAssoc = Array(); $aMapIds = $mapListXml->getElementsByTagName('ResourceId'); //iterate over mapIds to retrieve names for ( $i=0; $i < $aMapIds->length; $i++ ) { $mapId = new MgResourceIdentifier($aMapIds->item($i)->nodeValue); $aPair['id'] = $aMapIds->item($i)->nodeValue; $aPair['name'] = $mapId->GetName(); //Alternative - get the map description from the MapDefinition //$map = $resourceService->GetResourceContent($mapId); //$mapXml = DOMDocument::loadXML(ByteReaderToString($map)); //$name = $mapXml->getElementsByTagName('Name')->item(0)->nodeValue; //$aPair['name'] = $name; $aMapAssoc[] = $aPair; } //output map list as xml header('content-type: text/xml'); echo ""; for ( $i=0; $i < count($aMapAssoc); $i++ ){ echo ""; echo "".$aMapAssoc[$i]['id'].""; echo "".$aMapAssoc[$i]['name'].""; echo ""; } echo ""; exit; function ByteReaderToString($byteReader) { $buffer = ''; do { $data = str_pad("\0", 50000, "\0"); $len = $byteReader->Read($data, 50000); if ($len > 0) { $buffer = $buffer . substr($data, 0, $len); } } while ($len > 0); return $buffer; } ?>