401 instantiations of XElement
BuildBoss (1)
CustomEncryptorSample (3)
dotnet-svcutil-lib (13)
Shared\MSBuildProj.cs (12)
84_projectReferenceGroup = new XElement("ItemGroup");
107_referenceGroup = new XElement("ItemGroup");
131_packageReferenceGroup = new XElement("ItemGroup");
450XElement propertyGroup = new XElement(group);
538this.ProjectReferceGroup.Add(new XElement("ProjectReference", new XAttribute("Include", dependency.FullPath)));
541this.ReferenceGroup.Add(new XElement("Reference", new XAttribute("Include", dependency.AssemblyName), new XElement("HintPath", dependency.FullPath)));
544this.PacakgeReferenceGroup.Add(new XElement("PackageReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version)));
547this.ReferenceGroup.Add(new XElement("DotNetCliToolReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version)));
561this.ReferenceGroup.Add(new XElement("Content",
571this.PacakgeReferenceGroup.Add(new XElement("Content",
598XElement element = new XElement(propertyName, null);
dotnet-user-jwts (2)
dotnet-user-secrets (2)
IIS.FunctionalTests (2)
IIS.LongTests (3)
IIS.NewHandler.FunctionalTests (3)
IIS.NewShim.FunctionalTests (3)
IIS.ShadowCopy.Tests (1)
IISExpress.FunctionalTests (4)
illink (7)
Linker\WarningSuppressionWriter.cs (7)
61 var xmlTree = new XElement ("linker");
62 var xmlAssembly = new XElement ("assembly", new XAttribute ("fullname", assemblyName.FullName));
67 new XElement ("attribute",
69 new XElement ("argument", Constants.ILLink),
70 new XElement ("argument", $"IL{warning.Code}"),
71 new XElement ("property", new XAttribute ("name", UnconditionalSuppressMessageAttributeState.ScopeProperty),
73 new XElement ("property", new XAttribute ("name", UnconditionalSuppressMessageAttributeState.TargetProperty),
ILLink.Tasks (1)
Microsoft.AspNetCore.App.Analyzers.Test (4)
Microsoft.AspNetCore.Authentication.Test (7)
Microsoft.AspNetCore.DataProtection (45)
KeyManagement\XmlKeyManager.cs (12)
387var revocationElement = new XElement(RevocationElementName,
389new XElement(RevocationDateElementName, revocationDate),
391new XElement(KeyElementName,
393new XElement(ReasonElementName, reason));
524var keyElement = new XElement(KeyElementName,
527new XElement(CreationDateElementName, creationDate),
528new XElement(ActivationDateElementName, activationDate),
529new XElement(ExpirationDateElementName, expirationDate),
632var revocationElement = new XElement(RevocationElementName,
634new XElement(RevocationDateElementName, revocationDate),
635new XElement(KeyElementName,
637new XElement(ReasonElementName, reason));
Microsoft.AspNetCore.DataProtection.Tests (39)
KeyManagement\XmlKeyManagerTests.cs (10)
154new XElement("creationDate", creationDate),
155new XElement("activationDate", activationDate),
156new XElement("expirationDate", expirationDate));
253new XElement("creationDate", creationDate),
254new XElement("activationDate", activationDate),
255new XElement("expirationDate", expirationDate));
282new XElement("creationDate", creationDate),
283new XElement("activationDate", activationDate),
284new XElement("expirationDate", expirationDate));
712new XElement("revocationDate", revocationDate));
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (3)
Microsoft.AspNetCore.Http.Connections.Tests (2)
Microsoft.AspNetCore.Identity.InMemory.Test (3)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (1)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Rewrite (1)
Microsoft.AspNetCore.Server.IntegrationTesting (2)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (3)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
Microsoft.AspNetCore.SignalR.Tests (2)
Microsoft.Build.Tasks.Core (14)
Microsoft.Cci.Extensions (5)
Microsoft.CodeAnalysis (1)
Microsoft.CodeAnalysis.CodeStyle (13)
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (17)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (7)
200var element = new XElement("Tree",
210new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value), GetTextAttribute(text, kvp.Value))),
212new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value), GetTextAttribute(text, kvp.Value)))));
220new XElement("Diagnostic",
233var element = new XElement(node.Kind.ToString());
248var element = new XElement(alternationNode.Kind.ToString());
257var element = new XElement(token.Kind.ToString());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Microsoft.CodeAnalysis.Test.Utilities (4)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces (15)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (8)
Microsoft.DotNet.Arcade.Sdk (6)
Microsoft.DotNet.Build.Tasks.Installers (10)
Microsoft.DotNet.Build.Tasks.Workloads (6)
Msi\WorkloadPackGroupMsi.wix.cs (5)
95componentGroupRefElement.ReplaceWith(Enumerable.Range(1, _package.Packs.Count).Select(n => new XElement(ns + "ComponentGroupRef", new XAttribute("Id", "CG_PackageContents" + n))));
105registryKeyElement.Add(new XElement(ns + "RegistryKey", new XAttribute("Key", pack.Id),
106new XElement(ns + "RegistryKey", new XAttribute("Key", pack.PackageVersion),
107new XElement(ns + "RegistryValue", new XAttribute("Value", ""), new XAttribute("Type", "string")))));
184var xml = new XElement(ns + "Directory");
Microsoft.DotNet.PackageTesting (9)
Microsoft.DotNet.SharedFramework.Sdk (11)
Microsoft.DotNet.SourceBuild.Tasks (15)
Microsoft.DotNet.VersionTools (12)
Microsoft.DotNet.XliffTasks (10)
Model\XlfDocument.cs (7)
49new XElement(Xliff,
54new XElement(File,
59new XElement(Body))));
188new(TransUnit,
190new XElement(Source, sourceNode.Source),
191new XElement(Target, new XAttribute("state", "new"), sourceNode.Source),
192new XElement(Note, sourceNode.Note == "" ? null : sourceNode.Note));
Microsoft.Extensions.FileProviders.Embedded.Tests (6)
Microsoft.Maui.Resizetizer (13)
Microsoft.ML.Maml (1)
Microsoft.VisualStudio.LanguageServices (14)
Snippets\SnippetExpansionClient.cs (14)
657declarations.Add(new XElement(
659new XElement(snippetNamespace + "ID", new XText(parameter.Name)),
660new XElement(snippetNamespace + "Default", new XText(parameterValues.GetValueOrDefault(parameter.Name, "")))));
669declarations.Add(new XElement(
671new XElement(snippetNamespace + "ID", new XText(PlaceholderSnippetField)),
672new XElement(snippetNamespace + "Default", new XText(""))));
687new XElement(
689new XElement(
692new XElement(
694new XElement(snippetNamespace + "Title", new XText(methodName)),
695new XElement(snippetNamespace + "Description", new XText(s_fullMethodCallDescriptionSentinel))),
696new XElement(
698new XElement(snippetNamespace + "Declarations", declarations.ToArray()),
699new XElement(
PresentationFramework-SystemXmlLinq (1)
SignalR.Client.FunctionalTestApp (2)
Stress.ApiService (2)
System.Private.DataContractSerialization (1)
System.Private.Xml.Linq (14)
XmlFileLogger (19)
xunit.console (2)
2372 references to XElement
BuildBoss (16)
ConfigurationSchemaGenerator (6)
ConfigurationSchemaGenerator.Tests (8)
CustomEncryptorSample (4)
dotnet-svcutil-lib (47)
Shared\MSBuildProj.cs (45)
71private XElement ProjectNode { get; set; }
73private XElement _projectReferenceGroup;
74private XElement ProjectReferceGroup
80IEnumerable<XElement> refItems = this.ProjectNode.Elements("ProjectReference");
96private XElement _referenceGroup;
97private XElement ReferenceGroup
103IEnumerable<XElement> refItems = this.ProjectNode.Elements("Reference");
120private XElement _packageReferenceGroup;
121private XElement PacakgeReferenceGroup
127IEnumerable<XElement> refItems = this.ProjectNode.Elements("PackageReference");
189IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFramework");
211IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFrameworks");
245IEnumerable<XElement> runtimeIdentifierElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "RuntimeIdentifier");
251IEnumerable<XElement> packageReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "PackageReference");
252foreach (XElement reference in packageReferenceElements)
268IEnumerable<XElement> toolReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "DotNetCliToolReference");
269foreach (XElement reference in toolReferenceElements)
281IEnumerable<XElement> projectReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "ProjectReference");
282foreach (XElement reference in projectReferenceElements)
291IEnumerable<XElement> binReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "Reference");
292foreach (XElement reference in binReferenceElements)
302XElement hintPath = reference.Element("HintPath");
303XElement path = reference.Element("Path");
429var ele = doc.Root?.Descendants(elementStr).FirstOrDefault();
442private static IEnumerable<XElement> GetGroupValues(XElement projectElement, string group, bool createOnMissing = false)
445IEnumerable<XElement> groups = projectElement.Elements(group);
450XElement propertyGroup = new XElement(group);
452return new XElement[] { propertyGroup };
459private static IEnumerable<XElement> GetSubGroupValues(XElement projectElement, XNamespace msbuildNS, string group, string subGroupName)
461IEnumerable<XElement> groups = GetGroupValues(projectElement, group);
462IEnumerable<XElement> subGroupValues = groups.Elements(msbuildNS + subGroupName);
466private static string GetItemValue(XElement reference, string itemName, bool throwIfMissing = false)
475XElement itemNameElement = null;
489public static bool TryGetItemIdentity(XElement itemName, out string itemIdentity)
503private static string GetItemIdentity(XElement itemName)
598XElement element = new XElement(propertyName, null);
600IEnumerable<XElement> existingElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", propertyName);
607IEnumerable<XElement> propertyGroupItems = GetGroupValues(this.ProjectNode, "PropertyGroup", createOnMissing: true);
608XElement propertyGroup = propertyGroupItems.First();
657IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFramework");
660var targetFrameworkNode = targetFrameworkElements.Last();
665IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFrameworks");
668var targetFrameworksNode = targetFrameworksElements.Last();
dotnet-user-jwts (4)
dotnet-user-secrets (4)
IIS.FunctionalTests (16)
IIS.LongTests (10)
IIS.NewHandler.FunctionalTests (10)
IIS.NewShim.FunctionalTests (10)
IIS.ShadowCopy.Tests (6)
IIS.Tests (2)
IISExpress.FunctionalTests (20)
illink (2)
ILLink.Tasks (2)
KeyManagementSimulator (9)
Microsoft.AspNetCore.App.Analyzers.Test (9)
Microsoft.AspNetCore.App.UnitTests (1)
Microsoft.AspNetCore.Authentication.Test (26)
Microsoft.AspNetCore.CookiePolicy.Test (3)
Microsoft.AspNetCore.DataProtection (159)
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (4)
Microsoft.AspNetCore.DataProtection.StackExchangeRedis (4)
Microsoft.AspNetCore.DataProtection.Tests (155)
KeyManagement\DeferredKeyTests.cs (7)
25mockInternalKeyManager.Setup(o => o.DeserializeDescriptorFromKeyElement(It.IsAny<XElement>()))
26.Returns<XElement>(element =>
34var key = new Key(keyId, creationDate, activationDate, expirationDate, mockInternalKeyManager.Object, XElement.Parse(@"<node />"), new[] { encryptorFactory });
50var key = new Key(Guid.Empty, now, now, now, new Mock<IInternalXmlKeyManager>().Object, XElement.Parse(@"<node />"), new[] { encryptorFactory });
64mockKeyManager.Setup(o => o.DeserializeDescriptorFromKeyElement(It.IsAny<XElement>()))
65.Returns<XElement>(element =>
73var key = new Key(Guid.Empty, now, now, now, mockKeyManager.Object, XElement.Parse(@"<node />"), new[] { encryptorFactory });
KeyManagement\KeyEscrowServiceProviderExtensionsTests.cs (8)
36mockKeyEscrowSink.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>()))
37.Callback<Guid, XElement>((keyId, element) =>
48sink.Store(new Guid("39974d8e-3e53-4d78-b7e9-4ff64a2a5d7b"), XElement.Parse("<theElement />"));
61mockKeyEscrowSink1.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>()))
62.Callback<Guid, XElement>((keyId, element) =>
68mockKeyEscrowSink2.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>()))
69.Callback<Guid, XElement>((keyId, element) =>
81sink.Store(new Guid("39974d8e-3e53-4d78-b7e9-4ff64a2a5d7b"), XElement.Parse("<theElement />"));
KeyManagement\XmlKeyManagerTests.cs (33)
23private static readonly XElement serializedDescriptor = XElement.Parse(@"
84XElement elementStoredInRepository = null;
95.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>()))
96.Callback<XElement, string>((el, friendlyName) =>
171XElement elementStoredInEscrow = null;
173XElement elementStoredInRepository = null;
184.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>()))
185.Callback<XElement, string>((el, friendlyName) =>
192.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>()))
193.Callback<Guid, XElement>((innerKeyId, el) =>
599mockXmlRepository.Setup(o => o.GetAllElements()).Returns(XElement.Parse(xml).Elements().ToArray());
616XElement elementStoredInRepository = null;
620.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>()))
621.Callback<XElement, string>((el, friendlyName) =>
666XElement elementStoredInRepository = null;
670.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>()))
671.Callback<XElement, string>((el, friendlyName) =>
768.Setup(o => o.ImportFromXml(It.IsAny<XElement>()))
775.Setup(o => o.Decrypt(It.IsAny<XElement>()))
776.Returns<XElement>(element =>
785.Setup(o => o.Encrypt(It.IsAny<XElement>()))
787.Returns<XElement>(element => new EncryptedXmlInfo(element, typeof(IXmlDecryptor)));
850.Setup(o => o.ImportFromXml(It.IsAny<XElement>()))
857.Setup(o => o.Decrypt(It.IsAny<XElement>()))
858.Returns<XElement>(element =>
875var keyElement = XElement.Parse(@"
1007IReadOnlyCollection<XElement> IXmlRepository.GetAllElements() => [];
1008void IXmlRepository.StoreElement(XElement element, string friendlyName) => throw new InvalidOperationException();
1017IReadOnlyCollection<XElement> IXmlRepository.GetAllElements() => [];
1018void IXmlRepository.StoreElement(XElement element, string friendlyName) => throw new InvalidOperationException();
1024public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element)
Microsoft.AspNetCore.Http.Connections.Tests (7)
Microsoft.AspNetCore.Identity.InMemory.Test (4)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
Microsoft.AspNetCore.Mvc.FunctionalTests (10)
Microsoft.AspNetCore.Rewrite (20)
IISUrlRewrite\UrlRewriteFileParser.cs (13)
24var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault();
39private void ParseRules(XElement? rules, IList<IISUrlRewriteRule> result, bool global)
46foreach (var rule in rules.Elements(RewriteTags.Rule))
58private void ParseRuleAttributes(XElement rule, UrlRewriteRuleBuilder builder)
74var match = rule.Element(RewriteTags.Match);
80var action = rule.Element(RewriteTags.Action);
91private static void ParseMatch(XElement match, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax)
104private void ParseConditions(XElement? conditions, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax)
121foreach (var cond in adds)
127private void ParseCondition(XElement conditionElement, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax)
188private void ParseUrlAction(XElement urlAction, UrlRewriteRuleBuilder builder, bool stopProcessing)
253private static bool ParseBool(XElement element, string rewriteTag, bool defaultValue)
268private static TEnum ParseEnum<TEnum>(XElement element, string rewriteTag, TEnum defaultValue)
Microsoft.AspNetCore.Rewrite.Tests (1)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (56)
XElementExtensions.cs (12)
10public static XElement RequiredElement(this XElement element, string name)
12var existing = element.Element(name);
21public static XElement GetOrAdd(this XElement element, string name)
23var existing = element.Element(name);
33public static XElement GetOrAdd(this XElement element, string name, string attribute, string attributeValue)
35var existing = element.Elements(name).FirstOrDefault(e => e.Attribute(attribute)?.Value == attributeValue);
45public static XElement AddAndGetInnerElement(this XElement element, string name, string attribute, string attributeValue)
47var innerElement = new XElement(name, new XAttribute(attribute, attributeValue));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (7)
Microsoft.AspNetCore.SignalR.Tests (7)
Microsoft.Build.BuildCheck.UnitTests (1)
Microsoft.Build.CommandLine.UnitTests (1)
Microsoft.Build.Engine.OM.UnitTests (1)
Microsoft.Build.Engine.UnitTests (1)
Microsoft.Build.Framework.UnitTests (1)
Microsoft.Build.Tasks.Core (23)
Microsoft.Build.Tasks.UnitTests (3)
Microsoft.Build.Utilities.UnitTests (1)
Microsoft.Cci.Extensions (5)
Microsoft.CodeAnalysis (17)
Microsoft.CodeAnalysis.CodeStyle (40)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp (8)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (38)
NavigateTo\NavigateToTests.cs (9)
87var content = XElement.Parse("""
108var content = XElement.Parse("""
1723await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
1768await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
1813await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
1858await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
1903await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (28)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (7)
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (23)
Workspaces\EditorTestWorkspace_Create.cs (5)
15=> Create(XElement.Parse(xmlDefinition), openDocuments, composition);
18XElement workspaceElement,
27XElement workspaceElement,
92var workspaceElement = CreateWorkspaceElement(language, compilationOptions, parseOptions, files, sourceGeneratedFiles, metadataReferences, extension, commonReferences, isMarkup);
107var workspaceElement = CreateWorkspaceElement(
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.Features (19)
SymbolSearch\Windows\SymbolSearchUpdateEngine.Update.cs (11)
242var element = await DownloadFileAsync(serverPath, cancellationToken).ConfigureAwait(false);
250FileInfo databaseFileInfo, XElement element, CancellationToken cancellationToken)
422var element = await DownloadFileAsync(serverPath, cancellationToken).ConfigureAwait(false);
467FileInfo databaseFileInfo, XElement patchElement, Func<byte[]> getDatabaseBytes, CancellationToken cancellationToken)
491FileInfo databaseFileInfo, XElement patchElement, Func<byte[]> getDatabaseBytes, CancellationToken cancellationToken)
535private static void ParsePatchElement(XElement patchElement, out bool upToDate, out bool tooOld, out byte[]? patchBytes)
571private async Task<XElement> DownloadFileAsync(string serverPath, CancellationToken cancellationToken)
611private async Task<(XElement? element, TimeSpan delay)> TryDownloadFileAsync(IFileDownloader fileDownloader, CancellationToken cancellationToken)
644var element = XElement.Load(reader);
686private async Task<(bool succeeded, byte[]? contentBytes)> TryParseDatabaseElementAsync(XElement element, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
Microsoft.CodeAnalysis.LanguageServer.Protocol (17)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
Microsoft.CodeAnalysis.Test.Utilities (77)
Assert\AssertXml.cs (47)
32Equal(XElement.Parse(expected), XElement.Parse(actual), message: null, expectedValueSourcePath: null, expectedValueSourceLine: 0, expectedIsXmlLiteral: true);
35public static void Equal(XElement expected, XElement actual)
44XElement expectedRoot,
45XElement actualRoot,
65private static string GetXmlString(XElement node, bool expectedIsXmlLiteral)
91XElement expectedRoot,
92Tuple<XElement, XElement> firstMismatch,
140private static bool CheckEqual(XElement expectedRoot, XElement actualRoot, IEqualityComparer<XElement> shallowComparer, out Tuple<XElement, XElement> firstMismatch)
146Tuple<XElement, XElement> rootPair = new Tuple<XElement, XElement>(expectedRoot, actualRoot);
154Stack<Tuple<XElement, XElement>> stack = new Stack<Tuple<XElement, XElement>>();
159Tuple<XElement, XElement> pair = stack.Pop();
163XElement[] children1 = pair.Item1.Elements().ToArray();
164MultiDictionary<XElement, XElement> children2Dict = new MultiDictionary<XElement, XElement>(shallowComparer);
167foreach (XElement child in pair.Item2.Elements())
178HashSet<XElement> children2Used = new HashSet<XElement>(ReferenceEqualityComparer.Instance);
179foreach (XElement child1 in children1)
181XElement child2 = null;
198stack.Push(new Tuple<XElement, XElement>(child1, child2));
212private class ShallowElementComparer : IEqualityComparer<XElement>
214public static readonly IEqualityComparer<XElement> Instance = new ShallowElementComparer();
218public bool Equals(XElement element1, XElement element2)
228public int GetHashCode(XElement element)
237private class NameAndAttributeComparer : IEqualityComparer<XElement>
239public static readonly IEqualityComparer<XElement> Instance = new NameAndAttributeComparer();
243public bool Equals(XElement element1, XElement element2)
259public int GetHashCode(XElement element)
Syntax\XmlHelpers.cs (14)
49private static void AddNodeInfo(NodeInfo info, XElement xml)
61public static void AddInfo(SyntaxNode node, XElement xml)
66public static void AddInfo(SyntaxNodeOrToken node, XElement xml)
71public static void AddInfo(SyntaxToken node, XElement xml)
76public static void AddInfo(SyntaxTrivia node, XElement xml)
81public static void AddErrors(XElement xml)
98public static XElement ToXml(this SyntaxNodeOrToken node, SyntaxTree syntaxTree, XmlOptions options = null)
100XElement xml = null;
113public static XElement ToXml(this SyntaxNode node, SyntaxTree syntaxTree, XmlOptions options = null)
120XElement xml = null;
157public static XElement ToXml(this SyntaxToken token, SyntaxTree syntaxTree, XmlOptions options = null)
164XElement retVal = new XElement("Node",
210public static XElement ToXml(this SyntaxTrivia trivia, SyntaxTree syntaxTree, XmlOptions options = null)
217XElement retVal = new XElement("Node",
Microsoft.CodeAnalysis.VisualBasic (6)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (6)
273Dim element = DirectCast(node, XElement)
304Dim element = DirectCast(container, XElement)
431Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean
441Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode()
511Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath)
579Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (64)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (7)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (22)
FlowAnalysis\FlowTestBase.vb (11)
61Protected Function CompileAndAnalyzeControlFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As ControlFlowAnalysis
65Protected Function CompileAndAnalyzeDataFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As DataFlowAnalysis
69Protected Function CompileAndAnalyzeControlAndDataFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As Tuple(Of ControlFlowAnalysis, DataFlowAnalysis)
73Private Function CompileAndGetModelAndSpan(Of T)(program As XElement, analysisDelegate As Func(Of SemanticModel, List(Of VisualBasicSyntaxNode), List(Of VisualBasicSyntaxNode), T), ilSource As XCData, errors As XElement) As T
80Protected Function CompileAndGetModelAndSpan(program As XElement, startNodes As List(Of VisualBasicSyntaxNode), endNodes As List(Of VisualBasicSyntaxNode), ilSource As XCData, errors As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As VisualBasicCompilation
211code As XElement,
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (78)
SymbolDisplay\SymbolDisplayTests.vb (21)
3654Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3697Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3731Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3792Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3870Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3910Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3935Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3960Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
3984Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4150Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4202Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4252Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4297Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4344Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4371code = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4416Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4472Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4613Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
4798Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
6038text As XElement,
6082text As XElement,
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (30)
CompilationTestUtils.vb (21)
165Public Function CreateCompilationWithWinRt(source As XElement) As VisualBasicCompilation
169Public Function CreateCompilationWithMscorlib40AndReferences(source As XElement,
186Public Function CreateCompilationWithMscorlib40(source As XElement,
203source As XElement,
223Public Function CreateCompilationWithMscorlib40AndVBRuntime(source As XElement,
245source As XElement,
270source As XElement,
289Public Function CreateEmptyCompilationWithReferences(source As XElement,
298Public Function ParseSourceXml(sources As XElement,
312Public Function ToSourceTrees(compilationSources As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As IEnumerable(Of SyntaxTree)
356Public Function CreateCompilationWithCustomILSource(sources As XElement, ilSource As XCData) As VisualBasicCompilation
373Public Function CreateCompilationWithCustomILSource(sources As XElement,
635Public Function CreateParseTree(programElement As XElement) As SyntaxTree
647Public Function CreateParseTreeAndSpans(programElement As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As (tree As SyntaxTree, spans As IList(Of TextSpan))
783Public Sub AssertTheseDeclarationDiagnostics(compilation As VisualBasicCompilation, errs As XElement, Optional suppressInfos As Boolean = True)
788Public Sub AssertTheseParseDiagnostics(compilation As VisualBasicCompilation, errs As XElement, Optional suppressInfos As Boolean = True)
801Public Sub AssertTheseCompileDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True)
817Public Sub AssertTheseEmitDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True)
830Public Sub AssertTheseDiagnostics(tree As SyntaxTree, errs As XElement, Optional suppressInfos As Boolean = True)
843Public Sub AssertTheseDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True)
867Public Sub AssertTheseDiagnostics(errors As ImmutableArray(Of Diagnostic), errs As XElement, Optional suppressInfos As Boolean = True)
Microsoft.CodeAnalysis.Workspaces (58)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (5)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (11)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (60)
Workspaces\TestWorkspace_Create.cs (5)
15=> Create(XElement.Parse(xmlDefinition), openDocuments, composition);
18XElement workspaceElement,
27XElement workspaceElement,
92var workspaceElement = CreateWorkspaceElement(language, compilationOptions, parseOptions, files, sourceGeneratedFiles, metadataReferences, extension, commonReferences, isMarkup);
107var workspaceElement = CreateWorkspaceElement(
Workspaces\TestWorkspace_XmlConsumption.cs (33)
117XElement workspaceElement,
118XElement projectElement,
163foreach (var documentElement in documentElements)
177foreach (var sourceGeneratedDocumentElement in projectElement.Elements(DocumentFromSourceGeneratorElementName))
202foreach (var additionalDocumentElement in additionalDocumentElements)
217foreach (var analyzerConfigElement in analyzerConfigElements)
233private static ParseOptions GetParseOptions(XElement projectElement, string language, HostLanguageServices languageServices)
240private static ParseOptions GetParseOptionsWorker(XElement projectElement, string language, HostLanguageServices languageServices)
328private static DocumentationMode? GetDocumentationMode(XElement projectElement)
341private string GetAssemblyName(XElement projectElement, ref int projectId)
357private string GetLanguage(XElement projectElement)
377private string GetRootNamespace(CompilationOptions compilationOptions, XElement projectElement)
396XElement projectElement,
400var compilationOptionsElement = projectElement.Element(CompilationOptionsElementName);
406private CompilationOptions CreateCompilationOptions(string language, XElement compilationOptionsElement, ParseOptions parseOptions)
545XElement workspaceElement,
546XElement documentElement,
566var originalProject = workspaceElement.Elements(ProjectElementName).FirstOrDefault(p =>
615var optionsElement = documentElement.Element(ParseOptionsElementName);
677private static TestDocumentServiceProvider? GetDocumentServiceProvider(XElement documentElement)
694private string GetFileName(XElement documentElement, ref int documentId)
708private static IReadOnlyList<string> GetFolders(XElement documentElement)
724private MetadataReference CreateMetadataReferenceFromSource(XElement projectElement, XElement referencedSource)
753private Compilation CreateCompilation(XElement referencedSource)
775foreach (var documentElement in documentElements)
802private IList<MetadataReference> CreateReferenceList(XElement element)
805foreach (var reference in element.Elements(MetadataReferenceElementName))
815foreach (var metadataReferenceFromSource in element.Elements(MetadataReferenceFromSourceElementName))
823private static IList<AnalyzerReference> CreateAnalyzerList(XElement projectElement)
826foreach (var analyzer in projectElement.Elements(AnalyzerElementName))
838private IList<MetadataReference> CreateCommonReferences(XElement element)
956private static void AssertNoChildText(XElement element)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Microsoft.DotNet.Arcade.Sdk (14)
Microsoft.DotNet.Arcade.Sdk.Tests (3)
Microsoft.DotNet.Build.Tasks.Feed (1)
Microsoft.DotNet.Build.Tasks.Installers (10)
Microsoft.DotNet.Build.Tasks.Packaging (2)
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Microsoft.DotNet.Build.Tasks.Workloads (6)
Microsoft.DotNet.MacOsPkg (7)
Microsoft.DotNet.NuGetRepack.Tasks (10)
Microsoft.DotNet.NuGetRepack.Tests (2)
Microsoft.DotNet.PackageTesting (4)
Microsoft.DotNet.SharedFramework.Sdk (6)
Microsoft.DotNet.SignTool.Tests (3)
Microsoft.DotNet.SourceBuild.Tasks (20)
Microsoft.DotNet.SourceBuild.Tasks.Tests (1)
ValidateUsageAgainstBaselineTests.cs (1)
42XElement
Microsoft.DotNet.VersionTools (36)
Microsoft.DotNet.VersionTools.Tasks (1)
Microsoft.DotNet.VersionTools.Tests (21)
Microsoft.DotNet.XliffTasks (61)
Microsoft.DotNet.XliffTasks.Tests (11)
Microsoft.Extensions.FileProviders.Embedded (11)
Microsoft.Extensions.FileProviders.Embedded.Tests (1)
Microsoft.Maui.Resizetizer (22)
Microsoft.ML.Maml (2)
Microsoft.VisualStudio.LanguageServices (21)
Microsoft.VisualStudio.LanguageServices.CSharp (9)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (3)
netstandard (1)
PresentationFramework-SystemXmlLinq (3)
Roslyn.Test.PdbUtilities (29)
Reader\PdbValidation.cs (29)
33XElement expectedPdb,
79XElement expectedPdb,
96public static void VerifyPdb(this CompilationDifference diff, IEnumerable<MethodDefinitionHandle> methodHandles, XElement expectedPdb)
116XElement expectedPdb,
191XElement expectedPdb,
205XElement expectedPdb,
306var actualPdb = XElement.Parse(PdbToXmlConverter.ToXml(pdbStream, peStream, pdbToXmlOptions, methodName: qualifiedMethodName)).ToString();
345var actualConverted = AdjustForConversionArtifacts(XElement.Parse(PdbToXmlConverter.ToXml(pdbStreamConverted, peStreamOriginal, pdbToXmlOptions, methodName: qualifiedMethodName)).ToString());
361var xml = XElement.Parse(pdb);
362var pendingRemoval = new List<XElement>();
363foreach (var e in xml.DescendantsAndSelf())
385foreach (var e in pendingRemoval)
396var actualXml = XElement.Parse(actualPdb);
397var expectedXml = XElement.Parse(expectedPdb);
428private static bool RemoveElements(IEnumerable<XElement> elements)
432foreach (var e in array)
440private static void RemoveEmptyCustomDebugInfo(XElement pdb)
447private static void RemoveEmptyScopes(XElement pdb)
455private static void RemoveEmptySequencePoints(XElement pdb)
462private static void RemoveEmptyMethods(XElement pdb)
469private static void RemoveNonPortableElements(XElement expectedNativePdb)
493private static void RemoveElementsWithSpecifiedFormat(XElement expectedNativePdb, string format)
500private static void RemoveFormatAttributes(XElement pdb)
502foreach (var element in pdb.DescendantsAndSelf())
651var pdbXml = XElement.Parse(pdb);
ServerComparison.FunctionalTests (1)
SignalR.Client.FunctionalTestApp (7)
System.ComponentModel.TypeConverter (52)
MS\Internal\Xml\Linq\ComponentModel\XComponentModel.cs (52)
44if (typeof(T) == typeof(XElement))
144internal sealed class XElementAttributePropertyDescriptor : XPropertyDescriptor<XElement, object>
155return _value = new XDeferredSingleton<XAttribute>((e, n) => e.Attribute(n), (component as XElement)!, null);
196internal sealed class XElementDescendantsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>>
198private XDeferredAxis<XElement>? _value;
207return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Descendants(n) : e.Descendants(), (component as XElement)!, null);
218XElement? e = sender as XElement;
225e = sender as XElement;
242XElement? e = sender as XElement;
249internal sealed class XElementElementPropertyDescriptor : XPropertyDescriptor<XElement, object>
251private XDeferredSingleton<XElement>? _value;
252private XElement? _changeState;
260return _value = new XDeferredSingleton<XElement>((e, n) => e.Element(n), (component as XElement)!, null);
270XElement? e = sender as XElement;
277e = sender as XElement;
285e = sender as XElement;
310XElement? e = sender as XElement;
317internal sealed class XElementElementsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>>
319private XDeferredAxis<XElement>? _value;
328return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Elements(n) : e.Elements(), (component as XElement)!, null);
338XElement? e = sender as XElement;
345e = sender as XElement;
353e = sender as XElement;
370XElement? e = sender as XElement;
374e = sender as XElement;
381internal sealed class XElementValuePropertyDescriptor : XPropertyDescriptor<XElement, string>
383private XElement? _element;
396_element = component as XElement;
404_element = component as XElement;
418if (sender is XElement || sender is XText)
433internal sealed class XElementXmlPropertyDescriptor : XPropertyDescriptor<XElement, string>
435private XElement? _element;
443_element = component as XElement;
499private readonly Func<XElement, XName?, IEnumerable<T>> _func;
500internal XElement element;
503public XDeferredAxis(Func<XElement, XName?, IEnumerable<T>> func, XElement element, XName? name)
543private readonly Func<XElement, XName, T?> _func;
544internal XElement element;
547public XDeferredSingleton(Func<XElement, XName, T?> func, XElement element, XName? name)
System.Private.DataContractSerialization (1)
System.Private.Xml.Linq (610)
System\Xml\Linq\Extensions.cs (126)
16/// Returns all of the <see cref="XAttribute"/>s for each <see cref="XElement"/> of
17/// this <see cref="IEnumerable"/> of <see cref="XElement"/>.
21/// Attributes for every <see cref="XElement"/> in the target <see cref="IEnumerable"/>
22/// of <see cref="XElement"/>.
24public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source)
33/// <see cref="XElement"/>'s <see cref="XAttribute"/>s in the target <see cref="IEnumerable"/>
34/// of <see cref="XElement"/> are scanned for a matching <see cref="XName"/>.
38/// Attributes with a matching <see cref="XName"/> for every <see cref="XElement"/> in
39/// the target <see cref="IEnumerable"/> of <see cref="XElement"/>.
41public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source, XName? name)
49/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent
50/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this
51/// <see cref="IEnumerable"/> of <see cref="XElement"/>.
54/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent
55/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this
56/// <see cref="IEnumerable"/> of <see cref="XElement"/>.
58public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source) where T : XNode
66/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent
68/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
71/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent
73/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
75public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source, XName? name) where T : XNode
79return name != null ? GetAncestors(source, name, false) : XElement.EmptySequence;
83/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
84/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root).
85/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of
86/// <see cref="XElement"/>.
89/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
90/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root).
91/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of
92/// <see cref="XElement"/>.
94public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source)
102/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
103/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root)
105/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
108/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
109/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root)
111/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
113public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source, XName? name)
117return name != null ? GetAncestors(source, name, true) : XElement.EmptySequence;
160/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children
161/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in
162/// this <see cref="IEnumerable"/> of <see cref="XElement"/>.
165/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children
166/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in
167/// this <see cref="IEnumerable"/> of <see cref="XElement"/>.
169public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source) where T : XContainer
177/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children
179/// for each <see cref="XElement"/> in the target <see cref="IEnumerable"/> of <see cref="XElement"/>.
182/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children
184/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
186public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source, XName? name) where T : XContainer
190return name != null ? GetDescendants(source, name, false) : XElement.EmptySequence;
194/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
195/// <see cref="XElement"/> and it's descendants
197/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
200/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
201/// <see cref="XElement"/> and descendants.
203/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
205public static IEnumerable<XNode> DescendantNodesAndSelf(this IEnumerable<XElement?> source)
213/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
214/// <see cref="XElement"/> and it's descendants (children and children's children down
215/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/>
216/// of <see cref="XElement"/>.
219/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
220/// <see cref="XElement"/> and it's descendants (children and children's children down
221/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/>
222/// of <see cref="XElement"/>.
224public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source)
232/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
233/// <see cref="XElement"/> and it's descendants (children and children's children down
235/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
238/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
239/// <see cref="XElement"/> and it's descendants (children and children's children down
241/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
243public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source, XName? name)
247return name != null ? GetDescendants(source, name, true) : XElement.EmptySequence;
251/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
252/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
255/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
256/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
258public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source) where T : XContainer
266/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
267/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
270/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
271/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
273public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source, XName? name) where T : XContainer
277return name != null ? GetElements(source, name) : XElement.EmptySequence;
281/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
282/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
285/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements
286/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>.
341private static IEnumerable<XAttribute> GetAttributes(IEnumerable<XElement?> source, XName? name)
343foreach (XElement? e in source)
360private static IEnumerable<XElement> GetAncestors<T>(IEnumerable<T?> source, XName? name, bool self) where T : XNode
366XElement? e = (self ? node : node.parent) as XElement;
370e = e.parent as XElement;
404private static IEnumerable<XElement> GetDescendants<T>(IEnumerable<T?> source, XName? name, bool self) where T : XContainer
412XElement e = (XElement)root;
429XElement? e = n as XElement;
437private static IEnumerable<XElement> GetElements<T>(IEnumerable<T?> source, XName? name) where T : XContainer
449XElement? e = n as XElement;
System\Xml\Linq\XElement.cs (257)
26/// An <see cref="XElement"/> can contain the following types of content:
29/// <item><see cref="XElement"/></item>
41public static IEnumerable<XElement> EmptySequence
45return Array.Empty<XElement>();
106public XElement(XElement other)
162internal static async Task<XElement> CreateAsync(XmlReader r, CancellationToken cancellationToken)
164XElement xe = new XElement(default(AsyncConstructionSentry));
170/// Outputs this <see cref="XElement"/>'s underlying XML tree. The output can
175/// Output this <see cref="XElement"/> to a file.
180/// <see cref="XElement.Save(string, SaveOptions)"/>) enabling
194/// Output this <see cref="XElement"/> to a file.
240if (n is XElement) return true;
323/// Returns this <see cref="XElement"/> and all of it's ancestors up
329/// Returns this <see cref="XElement"/> and all of it's ancestors up to
334/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of
335/// this <see cref="XElement"/>'s ancestors up to the root node (including
336/// this <see cref="XElement"/>.
338public IEnumerable<XElement> AncestorsAndSelf()
344/// Returns the ancestor(s) of this <see cref="XElement"/> with the matching
345/// <see cref="XName"/>. If this <see cref="XElement"/>'s <see cref="XName"/>
347/// resulting <see cref="IEnumerable"/> or <see cref="XElement"/>.
354/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the
355/// ancestors of this <see cref="XElement"/> with a matching <see cref="XName"/>.
357public IEnumerable<XElement> AncestorsAndSelf(XName? name)
359return name != null ? GetAncestors(name, true) : XElement.EmptySequence;
363/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/> that has this
388/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/>. Optionally
392/// Returns all of the <see cref="XAttribute"/>s associated with this <see cref="XElement"/>.
397/// associated with this <see cref="XElement"/>.
405/// Returns the <see cref="XAttribute"/>(s) associated with this <see cref="XElement"/> that has the passed
407/// <seealso cref="XElement.Attributes()"/>
421/// Get the self and descendant nodes for an <see cref="XElement"/>
430/// Returns this <see cref="XElement"/> and all of it's descendants. Overloads allow
432/// of a descendant <see cref="XElement"/> to match.
435/// Returns this <see cref="XElement"/> and all of it's descendant <see cref="XElement"/>s
436/// as an <see cref="IEnumerable"/> of <see cref="XElement"/>.
437/// <seealso cref="XElement.DescendantsAndSelf()"/>
440/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing this <see cref="XElement"/>
443public IEnumerable<XElement> DescendantsAndSelf()
449/// Returns the descendants of this <see cref="XElement"/> that have a matching <see cref="XName"/>
450/// to the one passed in, including, potentially, this <see cref="XElement"/>.
451/// <seealso cref="XElement.DescendantsAndSelf(XName)"/>
454/// The <see cref="XName"/> of the descendant <see cref="XElement"/> that is being targeted.
457/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of the descendant
458/// <see cref="XElement"/>s that have this <see cref="XName"/>.
460public IEnumerable<XElement> DescendantsAndSelf(XName? name)
462return name != null ? GetDescendants(name, true) : XElement.EmptySequence;
466/// Returns the default <see cref="XNamespace"/> of an <see cref="XElement"/>
475/// Get the namespace associated with a particular prefix for this <see cref="XElement"/>
501XElement? e = this;
528e = e.parent as XElement;
544/// <see cref="XElement"/> and initializing it from a data source containing
550/// <seealso cref="XElement.Parse(string)"/>
553/// Create a new <see cref="XElement"/> based on the contents of the file
555/// <see cref="XElement.Parse(string)"/> to create an <see cref="XElement"/> from
558/// <seealso cref="XElement.Parse(string)"/>
567/// A URI string referencing the file to load into a new <see cref="XElement"/>.
570/// An <see cref="XElement"/> initialized with the contents of the file referenced
573public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri)
579/// Create a new <see cref="XElement"/> based on the contents of the file
592/// A string representing the URI of the file to be loaded into a new <see cref="XElement"/>.
598/// An <see cref="XElement"/> initialized with the contents of the file referenced
602public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri, LoadOptions options)
612/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
617/// created <see cref="XElement"/>.
620/// A new <see cref="XElement"/> containing the contents of the passed in
623public static XElement Load(Stream stream)
629/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
640/// created <see cref="XElement"/>.
646/// A new <see cref="XElement"/> containing the contents of the passed in
649public static XElement Load(Stream stream, LoadOptions options)
659/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
670/// created <see cref="XElement"/>.
678/// A new <see cref="XElement"/> containing the contents of the passed in
681public static async Task<XElement> LoadAsync(Stream stream, LoadOptions options, CancellationToken cancellationToken)
694/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
699/// created <see cref="XElement"/>.
702/// A new <see cref="XElement"/> containing the contents of the passed in
705public static XElement Load(TextReader textReader)
711/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
722/// created <see cref="XElement"/>.
728/// A new <see cref="XElement"/> containing the contents of the passed in
731public static XElement Load(TextReader textReader, LoadOptions options)
741/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using
752/// created <see cref="XElement"/>.
760/// A new <see cref="XElement"/> containing the contents of the passed in
763public static async Task<XElement> LoadAsync(TextReader textReader, LoadOptions options, CancellationToken cancellationToken)
776/// Create a new <see cref="XElement"/> containing the contents of the
781/// <see cref="XElement"/>.
784/// A new <see cref="XElement"/> containing the contents of the passed
787public static XElement Load(XmlReader reader)
793/// Create a new <see cref="XElement"/> containing the contents of the
798/// <see cref="XElement"/>.
804/// A new <see cref="XElement"/> containing the contents of the passed
807public static XElement Load(XmlReader reader, LoadOptions options)
812XElement e = new XElement(reader, options);
819/// Create a new <see cref="XElement"/> containing the contents of the
824/// <see cref="XElement"/>.
832/// A new <see cref="XElement"/> containing the contents of the passed
835public static Task<XElement> LoadAsync(XmlReader reader, LoadOptions options, CancellationToken cancellationToken)
840return Task.FromCanceled<XElement>(cancellationToken);
844private static async Task<XElement> LoadAsyncInternal(XmlReader reader, LoadOptions options, CancellationToken cancellationToken)
848XElement e = new XElement(default(AsyncConstructionSentry));
859/// Parses a string containing XML into an <see cref="XElement"/>. Optionally
863/// Parses a string containing XML into an <see cref="XElement"/>.
869/// A string containing the XML to parse into an <see cref="XElement"/>.
872/// An <see cref="XElement"/> created from the XML string passed in.
874public static XElement Parse(string text)
880/// Parses a string containing XML into an <see cref="XElement"/> and optionally
894/// A string containing the XML to parse into an <see cref="XElement"/>.
900/// An <see cref="XElement"/> created from the XML string passed in.
902public static XElement Parse(string text, LoadOptions options)
915/// Removes content and attributes from this <see cref="XElement"/>.
916/// <seealso cref="XElement.RemoveAttributes"/>
926/// Removes that attributes of this <see cref="XElement"/>.
927/// <seealso cref="XElement.RemoveAll"/>
928/// <seealso cref="XElement.RemoveAttributes"/>
1032/// Output this <see cref="XElement"/> to the passed in <see cref="Stream"/>.
1037/// <see cref="XElement.Save(Stream, SaveOptions)"/>) enabling
1043/// The <see cref="Stream"/> to output this <see cref="XElement"/> to.
1051/// Output this <see cref="XElement"/> to a <see cref="Stream"/>.
1070/// Output this <see cref="XElement"/> to a <see cref="Stream"/>.
1094/// Output this <see cref="XElement"/> to the passed in <see cref="TextWriter"/>.
1099/// <see cref="XElement.Save(TextWriter, SaveOptions)"/>) enabling
1105/// The <see cref="TextWriter"/> to output this <see cref="XElement"/> to.
1113/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>.
1132/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>.
1156/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>.
1171/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>.
1201/// <seealso cref="XElement.SetElementValue"/>
1202/// <seealso cref="XElement.SetValue"/>
1241/// <seealso cref="XElement.SetAttributeValue"/>
1242/// <seealso cref="XElement.SetValue"/>
1257XElement? e = Element(name);
1278/// <seealso cref="XElement.SetAttributeValue"/>
1279/// <seealso cref="XElement.SetElementValue"/>
1296/// Write this <see cref="XElement"/> to the passed in <see cref="XmlWriter"/>.
1299/// The <see cref="XmlWriter"/> to write this <see cref="XElement"/> to.
1309/// Write this <see cref="XElement"/> to the passed in <see cref="XmlTextWriter"/>.
1312/// The <see cref="XmlTextWriter"/> to write this <see cref="XElement"/> to.
1325/// Cast the value of this <see cref="XElement"/> to a <see cref="string"/>.
1328/// If the <see cref="XElement"/> is a subtree (an <see cref="XElement"/>
1329/// that has <see cref="XElement"/> children. The concatenated string
1330/// value of all of the <see cref="XElement"/>'s text and descendants
1334/// The <see cref="XElement"/> to cast to a string.
1337/// The content of this <see cref="XElement"/> as a <see cref="string"/>.
1341public static explicit operator string?(XElement? element)
1348/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>.
1351/// The <see cref="XElement"/> to cast to <see cref="bool"/>.
1354/// The content of this <see cref="XElement"/> as a <see cref="bool"/>.
1363public static explicit operator bool(XElement element)
1371/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>?.
1374/// The <see cref="XElement"/> to cast to <see cref="bool"/>?.
1377/// The content of this <see cref="XElement"/> as a <see cref="bool"/>?.
1384public static explicit operator bool?(XElement? element)
1391/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>.
1394/// The <see cref="XElement"/> to cast to <see cref="int"/>.
1397/// The content of this <see cref="XElement"/> as a <see cref="int"/>.
1406public static explicit operator int(XElement element)
1414/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>?.
1417/// The <see cref="XElement"/> to cast to <see cref="int"/>?.
1420/// The content of this <see cref="XElement"/> as a <see cref="int"/>?.
1427public static explicit operator int?(XElement? element)
1434/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>.
1437/// The <see cref="XElement"/> to cast to <see cref="uint"/>.
1440/// The content of this <see cref="XElement"/> as a <see cref="uint"/>.
1449public static explicit operator uint(XElement element)
1457/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>?.
1460/// The <see cref="XElement"/> to cast to <see cref="uint"/>?.
1463/// The content of this <see cref="XElement"/> as a <see cref="uint"/>?.
1470public static explicit operator uint?(XElement? element)
1477/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>.
1480/// The <see cref="XElement"/> to cast to <see cref="long"/>.
1483/// The content of this <see cref="XElement"/> as a <see cref="long"/>.
1492public static explicit operator long(XElement element)
1500/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>?.
1503/// The <see cref="XElement"/> to cast to <see cref="long"/>?.
1506/// The content of this <see cref="XElement"/> as a <see cref="long"/>?.
1513public static explicit operator long?(XElement? element)
1520/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>.
1523/// The <see cref="XElement"/> to cast to <see cref="ulong"/>.
1526/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>.
1535public static explicit operator ulong(XElement element)
1543/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>?.
1546/// The <see cref="XElement"/> to cast to <see cref="ulong"/>?.
1549/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>?.
1556public static explicit operator ulong?(XElement? element)
1563/// Cast the value of this <see cref="XElement"/> to a <see cref="float"/>.
1566/// The <see cref="XElement"/> to cast to <see cref="float"/>.
1569/// The content of this <see cref="XElement"/> as a <see cref="float"/>.
1578public static explicit operator float(XElement element)
1586/// Cast the value of this <see cref="XElement"/> to an <see cref="float"/>?.
1589/// The <see cref="XElement"/> to cast to <see cref="float"/>?.
1592/// The content of this <see cref="XElement"/> as a <see cref="float"/>?.
1599public static explicit operator float?(XElement? element)
1606/// Cast the value of this <see cref="XElement"/> to a <see cref="double"/>.
1609/// The <see cref="XElement"/> to cast to <see cref="double"/>.
1612/// The content of this <see cref="XElement"/> as a <see cref="double"/>.
1621public static explicit operator double(XElement element)
1629/// Cast the value of this <see cref="XElement"/> to an <see cref="double"/>?.
1632/// The <see cref="XElement"/> to cast to <see cref="double"/>?.
1635/// The content of this <see cref="XElement"/> as a <see cref="double"/>?.
1642public static explicit operator double?(XElement? element)
1649/// Cast the value of this <see cref="XElement"/> to a <see cref="decimal"/>.
1652/// The <see cref="XElement"/> to cast to <see cref="decimal"/>.
1655/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>.
1664public static explicit operator decimal(XElement element)
1672/// Cast the value of this <see cref="XElement"/> to an <see cref="decimal"/>?.
1675/// The <see cref="XElement"/> to cast to <see cref="decimal"/>?.
1678/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>?.
1685public static explicit operator decimal?(XElement? element)
1692/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTime"/>.
1695/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>.
1698/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>.
1707public static explicit operator DateTime(XElement element)
1715/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTime"/>?.
1718/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>?.
1721/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>?.
1728public static explicit operator DateTime?(XElement? element)
1735/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTimeOffset"/>.
1738/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>.
1741/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>.
1750public static explicit operator DateTimeOffset(XElement element)
1758/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTimeOffset"/>?.
1761/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>?.
1764/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>?.
1771public static explicit operator DateTimeOffset?(XElement? element)
1778/// Cast the value of this <see cref="XElement"/> to a <see cref="TimeSpan"/>.
1781/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>.
1784/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>.
1793public static explicit operator TimeSpan(XElement element)
1801/// Cast the value of this <see cref="XElement"/> to an <see cref="TimeSpan"/>?.
1804/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>?.
1807/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>?.
1814public static explicit operator TimeSpan?(XElement? element)
1821/// Cast the value of this <see cref="XElement"/> to a <see cref="Guid"/>.
1824/// The <see cref="XElement"/> to cast to <see cref="Guid"/>.
1827/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>.
1836public static explicit operator Guid(XElement element)
1844/// Cast the value of this <see cref="XElement"/> to an <see cref="Guid"/>?.
1847/// The <see cref="XElement"/> to cast to <see cref="Guid"/>?.
1850/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>?.
1857public static explicit operator Guid?(XElement? element)
1872/// Generates a <see cref="XElement"/> from its XML representation.
1875/// The <see cref="XmlReader"/> stream from which the <see cref="XElement"/>
1888/// Converts a <see cref="XElement"/> into its XML representation.
1891/// The <see cref="XmlWriter"/> stream to which the <see cref="XElement"/>
1936private bool AttributesEqual(XElement e)
1960XElement? e = node as XElement;
1977private string? GetNamespaceOfPrefixInScope(string prefix, XElement? outOfScope)
1979XElement? e = this;
1993e = e.parent as XElement;
System.Xml.Linq (1)
System.Xml.XDocument (1)
XmlFileLogger (22)
xunit.console (10)
ConsoleRunner.cs (5)
273XElement assembliesElement = null;
290foreach (var assemblyElement in results.Where(result => result != null))
297var assemblyElement = ExecuteAssembly(consoleLock, assembly, serialize, needsXml, parallelizeTestCollections, maxThreadCount, diagnosticMessages, noColor, appDomains, failSkips, stopOnFail, project.Filters, internalDiagnosticMessages);
318XElement ExecuteAssembly(object consoleLock,
335var assemblyElement = needsXml ? new XElement("assembly") : null;