/// <summary> /// Get the filter (XslTransform) to use for import. /// </summary> /// <returns>System.Xml.Xsl.XslTransform containing the transform that will convert the input to the native feedlist format</returns> public XslTransform GetImportXsl() { string _formatName; if (this._feedFormat == ImportFeedFormat.Unknown) { this._feedFormat = this.DetectFormat(); } switch (this._feedFormat) { case ImportFeedFormat.OPML: _formatName = FILTER_FORMAT_OPML; break; case ImportFeedFormat.OCS: _formatName = FILTER_FORMAT_OCS; break; case ImportFeedFormat.SIAM: _formatName = FILTER_FORMAT_SIAM; break; case ImportFeedFormat.Bandit: case ImportFeedFormat.Unknown: default: return(null); } // Open the resource and build our XslTransform using (Stream _xsltStream = Resource.Manager.GetStream(String.Format("Resources.feedImportFilters.{0}.xslt", _formatName))) { XslTransform _xslt = new XslTransform(); _xslt.Load(new XmlTextReader(_xsltStream)); return(_xslt); } // // // TODO: Find a better way to get the Assembly short name (ex: NewsComponents) // string assemblyName = this.GetType().Assembly.FullName; // string resName = assemblyName.Substring(0,assemblyName.IndexOf(",")) + ".feedImportFilters"; // ResourceManager _importFilterRM = new ResourceManager(resName, this.GetType().Assembly); // _importFilterRM.IgnoreCase = true; // // // we can't load a string directly into an XslTransform, so we'll // // need to do a little conversion // string _xslText = _importFilterRM.GetString(_formatName); // System.IO.StringReader _sr = new System.IO.StringReader(_xslText); // XslTransform _xslt = new XslTransform(); // _xslt.Load(new XmlTextReader(_sr)); // // return _xslt; }
/// <summary> /// Instantiates a new ImportFilter from a string containing Xml text /// of the feed list /// </summary> /// <param name="FeedList">System.String containing Xml text of the feed list to process</param> public ImportFilter(string FeedList) { this._feedList = new XmlDocument(); this._feedList.LoadXml(FeedList); this._feedFormat = this.DetectFormat(); }
/// <summary> /// Instantiates a new ImportFilter from an XmlDocument containing the /// feed list /// </summary> /// <param name="FeedList">System.Xml.XmlDocument containing the Xml of the feed list to process</param> public ImportFilter(XmlDocument FeedList) { this._feedList = FeedList; this._feedFormat = this.DetectFormat(); }
/// <summary> /// This ctor instantiates a new ImportFilter without initializing the feed list. /// Sets this.Format = ImportFeedFormat.Unknown /// </summary> public ImportFilter() { this._feedList = null; this._feedFormat = ImportFeedFormat.Unknown; }