Пример #1
0
        public static XElement GetElement(ISrcMLArchive archive, SrcMLLocation location)
        {
            string fileName = location.SourceFileName;
            string query    = location.XPath;

            var unit = archive.GetXElementForSourceFile(fileName);

            var startingLength = fileName.Length + 23;
            var path           = query.Substring(startingLength);
            var element        = unit.XPathSelectElement(path, SrcMLNamespaces.Manager);

            return(element);
        }
Пример #2
0
        /// <summary>
        /// Gets the XElement referred to by <see cref="XPath"/>.
        /// </summary>
        /// <param name="archive">The archive for this location</param>
        /// <returns>The XElement referred to by <see cref="XPath"/></returns>
        public XElement GetXElement(ISrcMLArchive archive)
        {
            if (null == archive)
            {
                throw new ArgumentNullException("archive");
            }

            var unit = archive.GetXElementForSourceFile(this.SourceFileName);

            if (unit != null)
            {
                return(unit.XPathSelectElement(this.XPath, SrcMLNamespaces.Manager));
            }

            return(null);
        }
Пример #3
0
 /// <summary>
 /// Gets the XElement for the specified source file.
 /// </summary>
 /// <param name="sourceFilePath"></param>
 /// <returns></returns>
 public XElement GetXElementForSourceFile(string sourceFilePath)
 {
     return(CurrentSrcMLArchive == null ? null : CurrentSrcMLArchive.GetXElementForSourceFile(sourceFilePath));
 }