using System;
using System.Xml;

namespace MusicMetaTagger.Client.AllMusicGuide.RemoteDataAccess.Client
{
	public abstract class XmlClientBase : IXmlClientBase
	{
		public abstract XmlDocument Read(string criteria);

		protected static XmlDocument ReadFromCriteria(string urlFormat, string criteria)
		{
			
			if (String.IsNullOrEmpty(criteria))
				return new XmlDocument();
				//throw new ArgumentNullException("criteria");

			criteria = Uri.EscapeUriString(criteria);
			var url = String.Format(urlFormat, criteria);
			return WebXmlClient.GetHtmlXml(new Uri(url));
		}
	}
}