BBOS/src/bing/common/BingXMLDelegate.java
//Though not well organized this is up here so changes can be made without looking through the entire class.

Though not well organized this is up here so changes can be made without looking through the entire class.
Though not well organized this is up here so changes can be made without looking through the entire class .
private BingResult reflectiveLoad(String name, String namespace, Attributes attributeDict) throws Exception
	{
		int index = getClassIndex(name, namespace);
		if(index > -1)
		{
			Hashtable aDict = loadDictionary(attributeDict);
			switch(index)
			{
				case RESULT_INDEX + 0:
					return new BingWebResult(aDict);
				case RESULT_INDEX + 1:
					return new BingPhonebookResult(aDict);
				case RESULT_INDEX + 2:
					return new BingVideoResult(aDict);
				case RESULT_INDEX + 3:
					return new BingImageResult(aDict);
				case RESULT_INDEX + 4:
				case COMMON_INDEX + 9:
					return new BingNewsResult(aDict);
				case RESULT_INDEX + 5:
					return new BingAdResult(aDict);
				case RESULT_INDEX + 7:
					return new BingTranslationResult(aDict);
				case RESULT_INDEX + 8:
					return new BingSpellResult(aDict);
				case RESULT_INDEX + 9:
					return new BingMobileWebResult(aDict);
				case RESULT_INDEX + 10:
					return new BingInstantAnswerResult(aDict);
				case COMMON_INDEX + 0:
					return new DeepLinkArray(aDict);
				case COMMON_INDEX + 1:
					return new DeepLink(aDict);
				case COMMON_INDEX + 2:
					return new SearchTagArray(aDict);
				case COMMON_INDEX + 3:
					return new SearchTag(aDict);
				case COMMON_INDEX + 4:
				case COMMON_INDEX + 5:
					return new Thumbnail(aDict);
				case COMMON_INDEX + 6:
					return new NewsCollectionArray(aDict);
				case COMMON_INDEX + 7:
					return new NewsCollection(aDict);
				case COMMON_INDEX + 8:
					return new NewsArticleArray(aDict);
				case COMMON_INDEX + 10:
					return new RelatedSearchArray(aDict);
				case COMMON_INDEX + 11:
				case RESULT_INDEX + 6:
					return new BingRelatedSearchResult(aDict);
				default:
					throw new UnsupportedOperationException(bing.Bing.format(_resources.getString(BingResource.XML_REFLECT_CLASSNOTIMPLEMENTED), new Object[] { new Integer(index), name }));
			}
		}
		throw new InstantiationException(_resources.getString(BingResource.XML_REFLECT_NOCLASS));
	}
private BingResult reflectiveLoad ( String name , String namespace , Attributes attributeDict ) throws Exception { int index = getClassIndex ( name , namespace ) ; if ( index > - 1 ) { Hashtable aDict = loadDictionary ( attributeDict ) ; switch ( index ) { case RESULT_INDEX + 0 : return new BingWebResult ( aDict ) ; case RESULT_INDEX + 1 : return new BingPhonebookResult ( aDict ) ; case RESULT_INDEX + 2 : return new BingVideoResult ( aDict ) ; case RESULT_INDEX + 3 : return new BingImageResult ( aDict ) ; case RESULT_INDEX + 4 : case COMMON_INDEX + 9 : return new BingNewsResult ( aDict ) ; case RESULT_INDEX + 5 : return new BingAdResult ( aDict ) ; case RESULT_INDEX + 7 : return new BingTranslationResult ( aDict ) ; case RESULT_INDEX + 8 : return new BingSpellResult ( aDict ) ; case RESULT_INDEX + 9 : return new BingMobileWebResult ( aDict ) ; case RESULT_INDEX + 10 : return new BingInstantAnswerResult ( aDict ) ; case COMMON_INDEX + 0 : return new DeepLinkArray ( aDict ) ; case COMMON_INDEX + 1 : return new DeepLink ( aDict ) ; case COMMON_INDEX + 2 : return new SearchTagArray ( aDict ) ; case COMMON_INDEX + 3 : return new SearchTag ( aDict ) ; case COMMON_INDEX + 4 : case COMMON_INDEX + 5 : return new Thumbnail ( aDict ) ; case COMMON_INDEX + 6 : return new NewsCollectionArray ( aDict ) ; case COMMON_INDEX + 7 : return new NewsCollection ( aDict ) ; case COMMON_INDEX + 8 : return new NewsArticleArray ( aDict ) ; case COMMON_INDEX + 10 : return new RelatedSearchArray ( aDict ) ; case COMMON_INDEX + 11 : case RESULT_INDEX + 6 : return new BingRelatedSearchResult ( aDict ) ; default : throw new UnsupportedOperationException ( bing . Bing . format ( _resources . getString ( BingResource . XML_REFLECT_CLASSNOTIMPLEMENTED ) , new Object [ ] { new Integer ( index ) , name } ) ) ; } } throw new InstantiationException ( _resources . getString ( BingResource . XML_REFLECT_NOCLASS ) ) ; }
Though not well organized this is up here so changes can be made without looking through the entire class.
Though not well organized this is up here so changes can be made without looking through the entire class .
//This (and getClassIndex) are not efficient but until reflection is supported there is not much that can be done about it.
 //#3
