public static XElement GetElement(SrcMLArchive archive, SrcMLLocation location) { string fileName = location.SourceFileName; string query = location.XPath; var unit = archive.GetXElementForSourceFile(fileName); var element = unit.XPathSelectElement(query, SrcMLNamespaces.Manager); return element; }
/// <summary> /// Adds a new srcML location to this scope. /// </summary> /// <param name="location">the location to add</param> public virtual void AddSourceLocation(SrcMLLocation location) { Collection <SrcMLLocation> locationsForFile; if (!LocationDictionary.TryGetValue(location.SourceFileName, out locationsForFile)) { locationsForFile = new Collection <SrcMLLocation>(); LocationDictionary[location.SourceFileName] = locationsForFile; } locationsForFile.Add(location); }
/// <summary> /// Processes the child of the current reader position into a child of this object. /// </summary> /// <param name="reader">The XML reader</param> protected override void ReadXmlChild(XmlReader reader) { if (SrcMLLocation.XmlName == reader.Name) { Location = XmlSerialization.DeserializeSrcMLLocation(reader); } else if (XmlComponentsName == reader.Name) { AddComponents(XmlSerialization.ReadChildExpressions(reader)); } }
public static XElement GetElement(SrcMLArchive 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; }
/// <summary> /// Creates a location object for the given /// <paramref name="element"/>. /// </summary> /// <param name="element">The element to create a location for</param> /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will /// be set to see cref="FileName"/></returns> public SrcMLLocation CreateLocation(XElement element) { var location = new SrcMLLocation(element, this.FileName); return(location); }
/// <summary> /// Creates a location object for the given /// <paramref name="element"/>. /// </summary> /// <param name="element">The element to create a location for</param> /// <param name="isReference">whether or not this is a reference location</param> /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will /// be set to see cref="FileName"/></returns> public SrcMLLocation CreateLocation(XElement element, bool isReference) { var location = new SrcMLLocation(element, this.FileName, isReference); return(location); }
/// <summary> /// Add the given SrcMLLocation to the Locations collection. /// </summary> /// <param name="location">The location to add.</param> public virtual void AddLocation(SrcMLLocation location) { LocationList.Add(location); }
/// <summary> /// Creates a location object for the given <paramref name="element"/>. /// </summary> /// <param name="element">The element to create a location for</param> /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will be set to <see cref="FileName"/></returns> public SrcMLLocation CreateLocation(XElement element) { var location = new SrcMLLocation(element, this.FileName); return location; }
/// <summary> /// Creates a location object for the given <paramref name="element"/>. /// </summary> /// <param name="element">The element to create a location for</param> /// <param name="isReference">whether or not this is a reference location</param> /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will be set to <see cref="FileName"/></returns> public SrcMLLocation CreateLocation(XElement element, bool isReference) { var location = new SrcMLLocation(element, this.FileName, isReference); return location; }
/// <summary> /// Processes the child of the current reader position into a child of this object. /// </summary> /// <param name="reader">The XML reader</param> protected override void ReadXmlChild(XmlReader reader) { if(SrcMLLocation.XmlName == reader.Name) { Location = XmlSerialization.DeserializeSrcMLLocation(reader); } else if(XmlComponentsName == reader.Name) { AddComponents(XmlSerialization.ReadChildExpressions(reader)); } }