Exemplo n.º 1
0
        protected IXPathNavigable LoadContextItem(DocumentSet documentSet, ITaskItem input)
        {
            try
            {
                Log.LogMessage(MessageImportance.Low,
                               Resources.SettingContextItem,
                               input.ItemSpec);

                //TODO: use AnyURI when it supports windows paths
                var inputUri  = new Uri(input.GetMetadata("FullPath"));
                var navigable = documentSet.Document(new AnyUri(inputUri));
                return(navigable == null
                           ? null
                           : navigable.CreateNavigator());
            }
            catch (XmlException ex)
            {
                Log.LogErrorFromException(ex, false, true, ex.SourceUri);
                return(null);
            }
            catch (ArgumentException ex)
            {
                Log.LogErrorFromException(ex, false, true, null);
                return(null);
            }
            catch (InvalidOperationException ex)
            {
                Log.LogErrorFromException(ex, false, true, null);
                return(null);
            }
        }