public RelatedTagsList getRelated ( String tag ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_RELATED ) ; parameters . put ( "tag" , tag ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element tagsElement = response . getPayload ( ) ; RelatedTagsList tags = new RelatedTagsList ( ) ; tags . setSource ( tagsElement . getAttribute ( "source" ) ) ; NodeList tagElements = tagsElement . getElementsByTagName ( "tag" ) ; for ( int i = 0 ; i < tagElements . getLength ( ) ; i ++ ) { Element tagElement = ( Element ) tagElements . item ( i ) ; Tag t = new Tag ( ) ; t . setValue ( XMLUtilities . getValue ( tagElement ) ) ; tags . add ( t ) ; } return tags ; }
Get the related tags .