567 instantiations of XElement
aspire (53)
Packaging\NuGetConfigMerger.cs (17)
162var configuration = doc.Root ?? new XElement("configuration"); 171packageSources = new XElement("packageSources"); 221var add = new XElement("add"); 348targetSourceElement = new XElement("packageSource"); 363var packageElement = new XElement("package"); 411targetSourceElement = new XElement("packageSource"); 426var packageElement = new XElement("package"); 566var packageSourceElement = new XElement("packageSource"); 569var wildcardPackage = new XElement("package"); 605var wildcardPackage = new XElement("package"); 726var packageSourceMapping = new XElement("packageSourceMapping"); 738var packageSource = new XElement("packageSource"); 743var packageElement = new XElement("package"); 786var packageSourceElement = new XElement("packageSource"); 789var wildcardPackage = new XElement("package"); 969config = new XElement("config"); 980var globalPackagesFolderAdd = new XElement("add");
Projects\DotNetBasedAppHostServerProject.cs (20)
176var projectRefGroup = new XElement("ItemGroup"); 187projectRefGroup.Add(new XElement("ProjectReference", 189new XElement("IsAspireProjectResource", "false"))); 197projectRefGroup.Add(new XElement("ProjectReference", 199new XElement("IsAspireProjectResource", "false"))); 216projectRefGroup.Add(new XElement("ProjectReference", 218new XElement("IsAspireProjectResource", "false"))); 228doc.Root!.Add(new XElement("ItemGroup", 229otherPackages.Select(p => new XElement("PackageReference", 240doc.Root!.Add(new XElement("Import", new XAttribute("Project", appHostInTargets))); 244doc.Root!.Add(new XElement("Import", new XAttribute("Project", sdkInTargets))); 251doc.Root!.Add(new XElement("ItemGroup", 252new XElement("ProjectReference", new XAttribute("Include", dashboardProject)))); 258doc.Root!.Add(new XElement("ItemGroup", 259new XElement("ProjectReference", new XAttribute("Include", remoteHostProject)))); 263doc.Root!.Add(new XElement("Target", new XAttribute("Name", "_CSharpWriteHostProjectMetadataSources"))); 264doc.Root!.Add(new XElement("Target", new XAttribute("Name", "_CSharpWriteProjectMetadataSources"))); 379.Add(new XElement("RestoreAdditionalProjectSources", sourceList)); 383doc.Root!.Add(new XElement("ItemGroup", 384new XElement("None",
Projects\PrebuiltAppHostServer.cs (16)
273var propertyGroup = new XElement("PropertyGroup", 274new XElement("TargetFramework", DotNetBasedAppHostServerProject.TargetFramework), 275new XElement("EnableDefaultItems", "false"), 276new XElement("CopyLocalLockFileAssemblies", "true"), 277new XElement("ProduceReferenceAssembly", "false"), 278new XElement("EnableNETAnalyzers", "false"), 279new XElement("GenerateDocumentationFile", "false"), 280new XElement("OutDir", outputDir)); 288propertyGroup.Add(new XElement("RestoreAdditionalProjectSources", sourceList)); 293new XElement("Project", 299doc.Root!.Add(new XElement("ItemGroup", 306return new XElement("PackageReference", 314doc.Root!.Add(new XElement("ItemGroup", 315projectRefs.Select(p => new XElement("ProjectReference", 322new XElement("Target", 325new XElement("WriteLinesToFile",
Aspire.Hosting.Maui (17)
Utilities\MauiEnvironmentHelper.cs (17)
92var projectElement = new XElement("Project"); 95projectElement.Add(new XElement( 102var itemGroup = new XElement("ItemGroup"); 105itemGroup.Add(new XElement("_GeneratedAndroidEnvironment", new XAttribute("Include", $"{key}={value}"))); 110var targetElement = new XElement( 118targetElement.Add(new XElement( 127targetElement.Add(new XElement( 129new XElement("AndroidEnvironment", new XAttribute("Include", "$(IntermediateOutputPath)__aspire_environment__.txt")) 133targetElement.Add(new XElement( 135new XElement("FileWrites", new XAttribute("Include", "$(IntermediateOutputPath)__aspire_environment__.txt")) 139targetElement.Add(new XElement( 263var projectElement = new XElement("Project"); 266projectElement.Add(new XElement( 274var itemGroup = new XElement("ItemGroup"); 282itemGroup.Add(new XElement("MlaunchEnvironmentVariables", 289projectElement.Add(new XElement( 294new XElement(
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);
Shared\Utilities\RuntimeEnvironmentHelper.cs (1)
100var addElement = new XElement("add");
dotnet-user-jwts (2)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
dotnet-user-secrets (2)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
GenerateDocumentationAndConfigFiles (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
illink (7)
ILLink.Tasks (1)
CombineLinkerXmlFiles.cs (1)
30var combined = new XElement("linker");
Microsoft.AspNetCore.DataProtection (46)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (3)
43var encryptionElement = new XElement("encryption", 48: (object)new XElement("validation", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (2)
37var masterKeyElement = new XElement("masterKey", 39new XElement("value", unprotectedSecretAsBase64String));
KeyManagement\XmlKeyManager.cs (13)
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), 530new XElement(DescriptorElementName, 632var revocationElement = new XElement(RevocationElementName, 634new XElement(RevocationDateElementName, revocationDate), 635new XElement(KeyElementName, 637new XElement(ReasonElementName, reason));
Repositories\EphemeralXmlRepository.cs (3)
41yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 70deletableElements.Add(new DeletableElement(storedElement, new XElement(storedElement)));
XmlEncryption\CertificateXmlEncryptor.cs (1)
89xmlDocument.Load(new XElement("root", plaintextElement).CreateReader());
XmlEncryption\DpapiNGXmlEncryptor.cs (2)
85var element = new XElement("encryptedKey", 88new XElement("value",
XmlEncryption\DpapiXmlEncryptor.cs (2)
82var element = new XElement("encryptedKey", 84new XElement("value",
XmlEncryption\EncryptedXmlDecryptor.cs (1)
69xmlDocument.Load(new XElement("root", encryptedElement).CreateReader());
XmlEncryption\NullXmlDecryptor.cs (1)
31return new XElement(encryptedElement.Elements().Single());
XmlEncryption\NullXmlEncryptor.cs (2)
56var newElement = new XElement("unencryptedKey", 58new XElement(plaintextElement) /* copy ctor */);
XmlEncryption\XmlEncryptionExtensions.cs (7)
29var doc = new XDocument(new XElement(element)); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 56var newPlaceholder = new XElement("placeholder"); 111var doc = new XDocument(new XElement(element)); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 150new XElement(XmlConstants.EncryptedSecretElementName,
XmlExtensions.cs (1)
21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
XmlComments\XmlComment.InheritDoc.cs (2)
247var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 385XContainer temp = new XElement("temp");
Microsoft.AspNetCore.Rewrite (1)
IISUrlRewrite\UrlRewriteFileParser.cs (1)
28throw new InvalidUrlRewriteFormatException(new XElement(RewriteTags.Rewrite), "The root element '<rewrite>' is missing");
Microsoft.Build.Tasks.Core (14)
AssemblyDependency\GenerateBindingRedirects.cs (6)
84runtimeNode = new XElement("runtime"); 95select new XElement( 97new XElement( 99new XElement( 104new XElement( 340new XElement("configuration"));
AssemblyDependency\ResolveAssemblyReference.cs (4)
1388var node = new XElement( 1390new XElement( 1392new XElement( 1395new XElement(
CombineTargetFrameworkInfoProperties.cs (3)
50new("TargetFramework", new XAttribute("Name", EscapingUtilities.Escape(RootElementName))) : 51new(RootElementName); 55root.Add(new XElement(item.ItemSpec, item.GetMetadata("Value")));
CombineXmlElements.cs (1)
37XElement root = new XElement(RootElementName);
Microsoft.CodeAnalysis (1)
InternalUtilities\XmlUtilities.cs (1)
28XContainer temp = new XElement("temp");
Microsoft.CodeAnalysis.Analyzers (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.AnalyzerUtilities (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.CodeStyle (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.ResxSourceGenerator (18)
AbstractResxGenerator.cs (1)
798var escapedTrimmedValue = new XElement("summary", value).ToString();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.Workspaces (43)
Log\WorkspaceStructureLogger.cs (24)
40var workspaceElement = new XElement("workspace"); 71var workspaceAnalyzerReferencesElement = new XElement("workspaceAnalyzerReferences"); 80projectElement.Add(new XElement("workspaceDocuments", await CreateElementsForDocumentCollectionAsync(project.Documents, "document", cancellationToken).ConfigureAwait(false))); 81projectElement.Add(new XElement("workspaceAdditionalDocuments", await CreateElementsForDocumentCollectionAsync(project.AdditionalDocuments, "additionalDocuments", cancellationToken).ConfigureAwait(false))); 82projectElement.Add(new XElement("workspaceAnalyzerConfigDocuments", await CreateElementsForDocumentCollectionAsync(project.AnalyzerConfigDocuments, "analyzerConfigDocument", cancellationToken).ConfigureAwait(false))); 86projectElement.Add(new XElement("workspaceSourceGeneratedDocuments", CreateElementsForSourceGeneratedDocuments(sourceGeneratedDocuments))); 89var generatorDiagnosticsElement = new XElement("generatorDiagnostics"); 114var projectElement = new XElement("project"); 137var msbuildReferencesElement = new XElement("msbuildReferences"); 148var workspaceReferencesElement = new XElement("workspaceReferences"); 155var referenceElement = new XElement("projectReference", new XAttribute("id", SanitizePath(projectReference.ProjectId.ToString()))); 172var compilationReferencesElement = new XElement("compilationReferences"); 180var diagnosticsElement = new XElement("diagnostics"); 190=> new("diagnostic", 203var element = new XElement("sourceGeneratedDocument", 246return new XElement("compilationReference", 252return new XElement("peReference", 259return new XElement("metadataReference", new XAttribute("display", SanitizePath(reference.Display))); 264=> new("analyzerReference", 274var typesElement = new XElement("types"); 283typesElement.Add(new XElement("type", new XAttribute("name", type.ToDisplayString()))); 289return new XElement("compilation", 301var documentElement = new XElement(elementName, new XAttribute("path", SanitizePath(document.FilePath))); 310documentElement.Add(new XElement("loadDiagnostic", loadDiagnostic));
Shared\Extensions\ISymbolExtensions.cs (2)
439var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 574XContainer temp = new XElement("temp");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.DotNet.Arcade.Sdk (1)
src\GenerateResxSource.cs (1)
427string escapedTrimmedValue = new XElement("summary", value).ToString();
Microsoft.DotNet.Build.Manifest (5)
BlobArtifactModel.cs (1)
17public override XElement ToXml() => new XElement(
BuildIdentity.cs (1)
259public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes());
BuildModel.cs (1)
26public XElement ToXml() => new XElement(
PackageArtifactModel.cs (1)
60public override XElement ToXml() => new XElement(
PdbArtifactModel.cs (1)
29public override XElement ToXml() => new XElement(
Microsoft.DotNet.Build.Tasks.Installers (10)
src\GenerateMacOSDistributionFile.cs (10)
41var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 62var scriptElement = new XElement("script", new XCData(archScriptContent)); 65.Select(component => new XElement("choice", 70new XElement("pkg-ref", new XAttribute("id", component.GetMetadata("FileNameWithExtension"))))); 77choiceElements.Select(c => new XElement(c) 80choiceElements.Select(c => new XElement(c) 87.Select(c => new XElement("line", new XAttribute("choice", c.Attribute("id").Value))); 90.Select(component => new XElement("pkg-ref", 98optionsElement = new XElement("options"); 116document.Root.Add(new XElement("choices-outline", choiceLineElements));
Microsoft.DotNet.HotReload.Watch (2)
HotReload\HotReloadDotNetWatcher.cs (2)
1127var solutionElement = new XElement("Solution"); 1131solutionElement.Add(new XElement("Project", new XAttribute("Path", projectPath)));
Microsoft.DotNet.PackageTesting (9)
VerifyClosure.cs (9)
346var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 360linksElement.Add(new XElement(s_dgmlns + "Link", 369linksElement.Add(new XElement(s_dgmlns + "Link", 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 380categoriesElement.Add(new XElement(s_dgmlns + "Category", 385categoriesElement.Add(new XElement(s_dgmlns + "Category", 400parent.Add(new XElement(s_dgmlns + "Node",
Microsoft.DotNet.SharedFramework.Sdk (11)
src\arcade\src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (9)
346var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 360linksElement.Add(new XElement(s_dgmlns + "Link", 369linksElement.Add(new XElement(s_dgmlns + "Link", 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 380categoriesElement.Add(new XElement(s_dgmlns + "Category", 385categoriesElement.Add(new XElement(s_dgmlns + "Category", 400parent.Add(new XElement(s_dgmlns + "Node",
src\CreateFrameworkListFile.cs (2)
67var frameworkManifest = new XElement("FileList", rootAttributes); 158var element = new XElement(
Microsoft.DotNet.SourceBuild.Tasks (12)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (1)
30public XElement ToXml() => new XElement(
src\UsageReport\UsageData.cs (7)
18public XElement ToXml() => new XElement( 20CreatedByRid == null ? null : new XElement( 23ProjectDirectories?.Any() != true ? null : new XElement( 26.Select(dir => new XElement("Dir", dir))), 27NeverRestoredTarballPrebuilts?.Any() != true ? null : new XElement( 32IgnorePatterns?.Any() != true ? null : new XElement( 36Usages?.Any() != true ? null : new XElement(
src\UsageReport\UsagePattern.cs (1)
15public XElement ToXml() => new XElement(
src\UsageReport\WriteUsageReports.cs (1)
107var report = new XElement("AnnotatedUsages");
src\UsageReport\XmlParsingHelpers.cs (1)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement(
Microsoft.DotNet.XliffTasks (10)
Model\XElementExtensions.cs (3)
35targetElement = new XElement(Target, new XAttribute("state", "new")); 69targetElement = new XElement(Target); 122noteElement = new XElement(Note);
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.AI.Evaluation.Safety (3)
ContentSafetyServicePayloadUtilities.cs (3)
112item.Add(new XElement(questionElementName, question.Text)); 117item.Add(new XElement(answerElementName, answer.Text)); 122item.Add(new XElement(contextElementName, normalizedPerTurnContext[index]));
Microsoft.Maui.Resizetizer (13)
GeneratePackageAppxManifest.cs (10)
84 identity = new XElement(xidentity); 128 properties = new XElement(xproperties); 174 applications = new XElement(xapplications); 183 application = new XElement(xapplication); 192 visual = new XElement(xvisual); 255 tile = new XElement(xtile); 312 showname = new XElement(xshowname); 320 showname.Add(new XElement(xshowon, new XAttribute("Tile", "square150x150Logo"))); 322 showname.Add(new XElement(xshowon, new XAttribute("Tile", "wide310x150Logo"))); 331 splash = new XElement(xsplash);
GenerateTizenManifest.cs (3)
125 label = new XElement(xmlns + LabelName); 165 splashscreensElement = new XElement(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName);
Microsoft.ML.Maml (16)
HelpCommand.cs (16)
463var content = new XElement("Components", 466select new XElement("Component", 468new XElement("Name", c.Info.UserName), 469string.IsNullOrWhiteSpace(c.Info.Summary) ? null : new XElement("Summary", c.Info.Summary), 470new XElement("LoadNames", 472select new XElement("LoadName", l)), 473new XElement("Type", c.Info.Type.ToString()), 474new XElement("SignatureTypes", 476select new XElement("SignatureType", s.ToString())), 479: new XElement("Arguments", 481select new XElement("Argument", 482new XElement("LongName", a.LongName), 485: new XElement("ShortNames", 487select new XElement("ShortName", sn)), 488new XElement("HelpText", a.HelpText), 509return new XElement("DefaultValue", a.DefaultValue);
Microsoft.NET.Build.Tasks (9)
GenerateToolsSettingsFile.cs (5)
68XElement commandNode = new XElement("Command", 75runtimeIdentifierPackagesNode = new XElement("RuntimeIdentifierPackages"); 80var packageNode = new XElement("RuntimeIdentifierPackage"); 97var dotnetCliToolNode = new XElement("DotNetCliTool", 99new XElement("Commands", commandNode));
WriteAppConfigWithSupportedRuntime.cs (4)
72startupNode = new XElement("startup"); 123new XElement( 133new XElement( 155new XElement("configuration"));
Microsoft.NET.HostModel (5)
ComHost\RegFreeComManifest.cs (5)
30XElement manifest = new XElement(ns + "assembly", new XAttribute("manifestVersion", "1.0")); 31manifest.Add(new XElement(ns + "assemblyIdentity", 56XElement fileElement = new XElement(ns + "file", new XAttribute("name", comHostName)); 67XElement comClassElement = new XElement(ns + "comClass", new XAttribute("clsid", guid.ToString("B")), new XAttribute("threadingModel", "Both")); 90XElement typeLibElement = new XElement(ns + "typelib",
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (5)
BlazorWriteSatelliteAssemblyFile.cs (2)
28var root = new XElement("SatelliteAssembly"); 34root.Add(new XElement("Assembly",
CreateBlazorTrimmerRootDescriptorFile.cs (3)
41var roots = new XElement("linker"); 61roots.Add(new XElement("assembly", 63new XElement("type", attributes)));
Microsoft.NET.Sdk.Publish.Tasks (4)
Tasks\GenerateEnvTransform.cs (1)
77new XElement("environmentVariable", new XAttribute("name", envVariable.Key),
WebConfigTransform.cs (3)
72aspNetCoreElement = new XElement("add"); 202envVariableElement = new XElement("environmentVariable"); 215childElement = new XElement(childName);
Microsoft.NET.Sdk.StaticWebAssets.Tasks (55)
GeneratePackageAssetsTargetsFile.cs (6)
32var itemGroup = new XElement("ItemGroup"); 33var manifestItem = new XElement("StaticWebAssetPackageManifest", 35new XElement("SourceId", PackageId), 36new XElement("ContentRoot", $@"$(MSBuildThisFileDirectory)..\{normalizedPrefix}\"), 37new XElement("PackageRoot", @"$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..'))")); 42var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetEndpointsPropsFile.cs (7)
44var itemGroup = new XElement("ItemGroup"); 54itemGroup.Add(new XElement(nameof(StaticWebAssetEndpoint), 56new XElement(nameof(StaticWebAssetEndpoint.AssetFile), fullPathExpression), 57new XElement(nameof(StaticWebAssetEndpoint.Selectors), new XCData(StaticWebAssetEndpointSelector.ToMetadataValue(element.Selectors))), 58new XElement(nameof(StaticWebAssetEndpoint.EndpointProperties), new XCData(StaticWebAssetEndpointProperty.ToMetadataValue(element.EndpointProperties))), 59new XElement(nameof(StaticWebAssetEndpoint.ResponseHeaders), new XCData(StaticWebAssetEndpointResponseHeader.ToMetadataValue(element.ResponseHeaders))))); 63var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetsPropsFile.cs (21)
79var itemGroup = new XElement("ItemGroup"); 105itemGroup.Add(new XElement("StaticWebAsset", 107new XElement(SourceType, emittedSourceType), 108new XElement(SourceId, element.GetMetadata(SourceId)), 109new XElement(ContentRoot, @$"$(MSBuildThisFileDirectory)..\{Normalize(PackagePathPrefix)}\"), 110new XElement(BasePath, element.GetMetadata(BasePath)), 111new XElement(RelativePath, relativePath), 112new XElement(AssetKind, element.GetMetadata(AssetKind)), 113new XElement(AssetMode, element.GetMetadata(AssetMode)), 114new XElement(AssetRole, element.GetMetadata(AssetRole)), 115new XElement(RelatedAsset, element.GetMetadata(RelatedAsset)), 116new XElement(AssetTraitName, element.GetMetadata(AssetTraitName)), 117new XElement(AssetTraitValue, element.GetMetadata(AssetTraitValue)), 118new XElement(Fingerprint, element.GetMetadata(Fingerprint)), 119new XElement(Integrity, element.GetMetadata(Integrity)), 120new XElement(CopyToOutputDirectory, element.GetMetadata(CopyToOutputDirectory)), 121new XElement(CopyToPublishDirectory, element.GetMetadata(CopyToPublishDirectory)), 122new XElement(FileLength, element.GetMetadata(FileLength)), 123new XElement(LastWriteTime, element.GetMetadata(LastWriteTime)), 124new XElement(OriginalItemSpec, fullPathExpression))); 128var root = new XElement("Project", itemGroup);
Legacy\GenerateStaticWebAssetsPropsFile50.cs (17)
56var itemGroup = new XElement("ItemGroup"); 62itemGroup.Add(new XElement("StaticWebAsset", 64new XElement(SourceType, "Package"), 65new XElement(SourceId, element.GetMetadata(SourceId)), 66new XElement(ContentRoot, @$"$(MSBuildThisFileDirectory)..\{Normalize(PackagePathPrefix)}\"), 67new XElement(BasePath, element.GetMetadata(BasePath)), 68new XElement(RelativePath, element.GetMetadata(RelativePath)), 69new XElement(AssetKind, element.GetMetadata(AssetKind)), 70new XElement(AssetMode, element.GetMetadata(AssetMode)), 71new XElement(AssetRole, element.GetMetadata(AssetRole)), 72new XElement(RelatedAsset, element.GetMetadata(RelatedAsset)), 73new XElement(AssetTraitName, element.GetMetadata(AssetTraitName)), 74new XElement(AssetTraitValue, element.GetMetadata(AssetTraitValue)), 75new XElement(CopyToOutputDirectory, element.GetMetadata(CopyToOutputDirectory)), 76new XElement(CopyToPublishDirectory, element.GetMetadata(CopyToPublishDirectory)), 77new XElement(OriginalItemSpec, fullPathExpression))); 81var root = new XElement("Project", itemGroup);
Legacy\GenerateV1StaticWebAssetsManifest.cs (2)
38var root = new XElement( 123nodes.Add(new XElement("ContentRoot",
StaticWebAssetsGeneratePackagePropsFile.cs (2)
27var root = new XElement("Project"); 30root.Add(new XElement("Import", new XAttribute("Project", element)));
NuGet.Commands (19)
RestoreCommand\Utility\BuildAssetsUtils.cs (19)
134doc.Root.Add(new XElement(Namespace + "Target", 138new XElement(Namespace + "Warning", 213new XElement(Namespace + "PropertyGroup", 222new XElement(Namespace + "ItemGroup", 235new XElement(Namespace + "Project", 244return new XElement(Namespace + propertyName, 251return new XElement(Namespace + itemName, new XAttribute("Include", path)); 256return new XElement(Namespace + "Import", 263var entry = new XElement(Namespace + item.BuildAction.Value, 266new XElement(Namespace + "NuGetPackageId", packageId), 267new XElement(Namespace + "NuGetPackageVersion", packageVersion), 268new XElement(Namespace + "NuGetItemType", item.BuildAction), 269new XElement(Namespace + "Pack", false)); 283entry.Add(new XElement(Namespace + "CopyToOutputDirectory", "PreserveNewest")); 285entry.Add(new XElement(Namespace + "TargetPath", outputPath)); 291entry.Add(new XElement(Namespace + "DestinationSubDirectory", destinationSubDirectory + Path.DirectorySeparatorChar)); 296entry.Add(new XElement(Namespace + "Private", privateFlag.ToString(CultureInfo.CurrentCulture))); 306entry.Add(new XElement(Namespace + "Link", linkPath)); 331var itemGroup = new XElement(Namespace + group.RootName, group.Items);
NuGet.Configuration (10)
Settings\Items\AuthorItem.cs (1)
47var element = new XElement(ElementName);
Settings\Items\CredentialsItem.cs (1)
223var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName),
Settings\Items\FileClientCertItem.cs (1)
147var element = new XElement(ElementName);
Settings\Items\OwnersItem.cs (1)
76var element = new XElement(ElementName, _content.AsXNode());
Settings\Items\PackageSourceMappingSourceItem.cs (1)
132var element = new XElement(ElementName);
Settings\Items\RepositoryItem.cs (1)
111var element = new XElement(ElementName);
Settings\Items\StoreClientCertItem.cs (1)
222var element = new XElement(ElementName);
Settings\Items\UnknownItem.cs (1)
155var element = new XElement(ElementName, Children.Select(c => c.AsXNode()));
Settings\SettingElement.cs (1)
120var element = new XElement(ElementName);
Settings\SettingsGroup.cs (1)
62var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), Children.Select(c => c.AsXNode()));
NuGet.PackageManagement (3)
FileModifiers\XmlTransformer.cs (1)
135new XElement(xmlFragment.Name),
Utility\MSBuildNuGetProjectSystemUtility.cs (1)
36var document = new XDocument(new XElement(rootName));
Utility\XmlUtility.cs (1)
29var document = new XDocument(new XElement(rootName));
NuGet.Packaging (42)
PackageCreation\Authoring\Manifest.cs (3)
101new XElement(schemaNamespace + "package", 104new XElement(schemaNamespace + "files", 105Files.Select(file => new XElement(schemaNamespace + "file",
PackageCreation\Authoring\PackageBuilder.cs (15)
1192new XElement(relationships + "Relationships", 1193new XElement(relationships + "Relationship", 1197new XElement(relationships + "Relationship", 1217XElement element = new XElement(content + "Types", 1218new XElement(content + "Default", 1221new XElement(content + "Default", 1228new XElement(content + "Default", 1237new XElement(content + "Override", 1265new XElement(core + "coreProperties", 1269new XElement(dc + "creator", string.Join(", ", Authors)), 1270new XElement(dc + "description", Description), 1271new XElement(dc + "identifier", Id), 1272new XElement(core + "version", Version!.ToString()), 1274new XElement(core + "keywords", ((IPackageMetadata)this).Tags), 1276new XElement(core + "lastModifiedBy", CreatorInfo())
PackageCreation\Xml\PackageMetadataXmlExtensions.cs (21)
34var elem = new XElement(ns + "metadata"); 40elem.Add(new XElement(ns + "id", metadata.Id)); 50elem.Add(new XElement(ns + "developmentDependency", metadata.DevelopmentDependency)); 56elem.Add(new XElement(ns + "requireLicenseAcceptance", metadata.RequireLicenseAcceptance)); 85elem.Add(new XElement(ns + "serviceable", metadata.Serviceable)); 180var groupElem = new XElement( 197return new XElement(ns + parentName, childElements.ToArray()); 202return new XElement(ns + NuspecUtility.FrameworkReference, new XAttribute(NuspecUtility.Name, frameworkReference.Name)); 207return new XElement(ns + Reference, new XAttribute(File, reference)); 231return new XElement(ns + "dependency", attributes); 241return new XElement( 244new XElement(ns + FrameworkAssembly, 258return new XElement(ns + "contentFiles", 273return new XElement(ns + Files, attributes.Where(xAtt => xAtt != null)); 286return new XElement(ns + NuspecUtility.License, metadata.License, attributes.Where(xAtt => xAtt != null)); 314return new XElement(ns + NuspecUtility.Repository, attributeList); 321var packageTypesElement = new XElement(ns + NuspecUtility.PackageTypes); 342return new XElement(ns + NuspecUtility.PackageType, attributes.Where(xAtt => xAtt != null)); 360parent.Add(new XElement(ns + name, value)); 372parent.Add(new XElement(ns + name, processed)); 384parent.Add(new XElement(ns + name, processed));
PackagesConfigWriter.cs (3)
363var node = new XElement(XName.Get(PackagesConfig.PackageNodeName)); 402var packagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName)); 495var newPackagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName),
PresentationFramework-SystemXmlLinq (1)
SystemXmlLinqExtension.cs (1)
20XElement xelement = new XElement("Dummy");
Roslyn.Diagnostics.Analyzers (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Stress.ApiService (2)
Program.cs (2)
298var xmlWithUrl = new XElement(new XElement("url", "http://localhost:8080")).ToString();
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
373o = new System.Xml.Linq.XElement("default");
System.Private.Xml.Linq (14)
System\Xml\Linq\XContainer.cs (6)
164AddNode(new XElement(x)); 491AddNodeSkipNotify(new XElement(x)); 906XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 960XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1020XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1134XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName));
System\Xml\Linq\XElement.cs (5)
164XElement xe = new XElement(default(AsyncConstructionSentry)); 812XElement e = new XElement(reader, options); 848XElement e = new XElement(default(AsyncConstructionSentry)); 1270AddNode(new XElement(name, GetStringValue(value))); 1955return new XElement(this);
System\Xml\Linq\XLinq.cs (1)
95AddNode(new XElement(x));
System\Xml\Linq\XNode.cs (1)
441return new XElement(reader);
System\Xml\Linq\XNodeBuilder.cs (1)
183AddNode(new XElement(XNamespace.Get(namespaceName!).GetName(localName)));
2033 references to XElement
aspire (69)
Packaging\NuGetConfigMerger.cs (60)
15public required XElement Configuration { get; init; } 16public required XElement PackageSources { get; init; } 17public XElement? PackageSourceMapping { get; init; } 20public required XElement[] ExistingAdds { get; init; } 162var configuration = doc.Root ?? new XElement("configuration"); 168var packageSources = configuration.Element("packageSources"); 191private static Dictionary<string, string> BuildExistingSourceMappings(XElement[] existingAdds) 194foreach (var addElement in existingAdds) 221var add = new XElement("add"); 230var packageSourceMapping = context.PackageSourceMapping!; 247XElement packageSourceMapping, 256foreach (var packageSourceElement in packageSourceElements) 265var elementsToRemove = new List<XElement>(); 267foreach (var packageElement in packageElements) 310foreach (var element in elementsToRemove) 326XElement packageSourceMapping, 342var targetSourceElement = packageSourceMapping.Elements("packageSource") 357var existingPattern = targetSourceElement.Elements("package") 363var packageElement = new XElement("package"); 374XElement packageSourceMapping, 380foreach (var packageSourceElement in packageSourceMapping.Elements("packageSource")) 382foreach (var packageElement in packageSourceElement.Elements("package")) 405var targetSourceElement = packageSourceMapping.Elements("packageSource") 420var existingPattern = targetSourceElement.Elements("package") 426var packageElement = new XElement("package"); 437XElement packageSourceMapping, 450foreach (var elementToFix in packageSourceElementsToFix) 456var existingProperElement = packageSourceMapping.Elements("packageSource") 463foreach (var packageToMove in packagesToMove) 467var existingPattern = existingProperElement.Elements("package") 494XElement packageSourceMapping, 524var originalPsm = context.PackageSourceMapping; 527foreach (var ps in originalPsm.Elements("packageSource")) 552var sourceElement = context.ExistingAdds 566var packageSourceElement = new XElement("packageSource"); 569var wildcardPackage = new XElement("package"); 591var sourceElement = context.ExistingAdds 600var packageSourceElement = packageSourceMapping.Elements("packageSource") 605var wildcardPackage = new XElement("package"); 687XElement packageSourceMapping, 688XElement packageSources, 697foreach (var emptyElement in emptyPackageSourceElements) 714var sourceToRemove = packageSources.Elements("add") 726var packageSourceMapping = new XElement("packageSourceMapping"); 738var packageSource = new XElement("packageSource"); 743var packageElement = new XElement("package"); 754private static void PreserveOriginalSourceFunctionality(XElement packageSourceMapping, NuGetConfigContext context) 779var sourceElement = context.ExistingAdds 786var packageSourceElement = new XElement("packageSource"); 789var wildcardPackage = new XElement("package"); 839var packageSources = doc.Root?.Element("packageSources"); 853foreach (var addElement in existingAdds) 874var packageSourceMapping = doc.Root?.Element("packageSourceMapping"); 882foreach (var packageSourceElement in packageSourceElements) 891foreach (var packageElement in packageElements) 949var configuration = doc.Root ?? throw new InvalidOperationException("Invalid NuGet config structure"); 963private static void AddGlobalPackagesFolderConfiguration(XElement configuration) 966var config = configuration.Element("config"); 974var existingGlobalPackagesFolder = config.Elements("add") 980var globalPackagesFolderAdd = new XElement("add");
Projects\DotNetBasedAppHostServerProject.cs (1)
176var projectRefGroup = new XElement("ItemGroup");
Projects\FallbackProjectParser.cs (7)
75var root = doc.Root; 162private static string? ExtractAspireHostingSdkVersion(XElement projectRoot) 177var sdkElement = projectRoot 215private static PackageReferenceInfo[] ExtractPackageReferences(XElement projectRoot) 224foreach (var element in packageRefElements) 248private static ProjectReferenceInfo[] ExtractProjectReferences(XElement projectRoot, FileInfo projectFile) 257foreach (var element in projectRefElements)
Projects\PrebuiltAppHostServer.cs (1)
273var propertyGroup = new XElement("PropertyGroup",
Aspire.Cli.EndToEnd.Tests (1)
CentralPackageManagementTests.cs (1)
208foreach (var element in appHostProject.Descendants())
Aspire.Cli.Tests (28)
Packaging\NuGetConfigMergerTests.cs (24)
94var packageSources = xml.Root!.Element("packageSources")!; 98var psm = xml.Root!.Element("packageSourceMapping"); 135var packageSources = xml.Root!.Element("packageSources")!; 139var psm = xml.Root!.Element("packageSourceMapping")!; 174var packageSources = xml.Root!.Element("packageSources")!; 180var psm = xml.Root!.Element("packageSourceMapping")!; 214var psm = xml.Root!.Element("packageSourceMapping"); 324var packageSources = xml.Root!.Element("packageSources")!; 334var psm = xml.Root!.Element("packageSourceMapping")!; 335var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget"); 340var urlMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://api.nuget.org/v3/index.json"); 374var packageSources = xml.Root!.Element("packageSources")!; 390var psm = xml.Root!.Element("packageSourceMapping")!; 393var aspireMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://example.com/aspire-daily"); 398var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget.org"); 402var customMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "custom"); 443var packageSources = xml.Root!.Element("packageSources")!; 456var psm = xml.Root!.Element("packageSourceMapping")!; 459var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget.org"); 464var aspireMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://example.com/aspire-daily"); 509var packageSources = xml.Root!.Element("packageSources")!; 523var psm = xml.Root!.Element("packageSourceMapping")!; 530var validExampleMapping = psm.Elements("packageSource") 536var nugetMapping = psm.Elements("packageSource")
Packaging\PackagingServiceTests.cs (2)
379var configSection = doc.Root?.Element("config"); 382var globalPackagesFolderAdd = configSection.Elements("add")
Projects\AppHostServerProjectTests.cs (1)
155var noneElement = doc.Descendants("None")
Projects\PrebuiltAppHostServerTests.cs (1)
144var restoreSources = doc.Descendants(ns + "RestoreAdditionalProjectSources").FirstOrDefault();
Aspire.Dashboard (2)
Model\ResourceGraph\ResourceGraphMapper.cs (2)
90var e = XElement.Parse(p);
Aspire.Hosting.Maui (5)
Utilities\MauiEnvironmentHelper.cs (5)
92var projectElement = new XElement("Project"); 102var itemGroup = new XElement("ItemGroup"); 110var targetElement = new XElement( 263var projectElement = new XElement("Project"); 274var itemGroup = new XElement("ItemGroup");
Aspire.Hosting.RemoteHost (2)
AtsCapabilityScanner.cs (2)
2720var memberElement = xmlDoc.Descendants("member") 2723var summary = memberElement?.Element("summary");
Aspire.Hosting.Tasks (4)
GetNonExecutableReferences.cs (4)
42var additionalPropertiesXml = XElement.Parse(additionalProperties); 43foreach (var targetFrameworkElement in additionalPropertiesXml.Elements()) 45var isExe = targetFrameworkElement.Element("_IsExecutable");
ConfigurationSchemaGenerator (6)
ConfigSchemaEmitter.cs (6)
363return XElement.Parse(xml).ToString(SaveOptions.None); 437var memberRoot = doc.Element("member") ?? doc.Element("doc"); 438var summary = memberRoot?.Element("summary"); 469internal static string FormatDescription(XElement element) 508XElement element => GetElementText(element), 539private static string GetElementText(XElement element)
ConfigurationSchemaGenerator.Tests (8)
GeneratorTests.cs (8)
80var summaryElement = ConvertToSummaryElement(input); 97var summaryElement = ConvertToSummaryElement(input); 111var summaryElement = ConvertToSummaryElement(input); 129var summaryElement = ConvertToSummaryElement(input); 140var summaryElement = ConvertToSummaryElement(input); 151var summaryElement = ConvertToSummaryElement(input); 157private static XElement ConvertToSummaryElement(string input) 163return (XElement)XNode.ReadFrom(reader);
dotnet (2)
Commands\Run\CSharpCompilerCommand.cs (1)
418foreach (var file in frameworkList.Root?.Elements("File") ?? [])
ToolPackage\ToolConfigurationDeserializer.cs (1)
34var root = doc.Root;
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(); 662IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFramework"); 665var targetFrameworkNode = targetFrameworkElements.Last(); 670IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFrameworks"); 673var targetFrameworksNode = targetFrameworksElements.Last();
Shared\Utilities\RuntimeEnvironmentHelper.cs (2)
82var pkgSourcesNode = doc.Element("configuration")?.Element("packageSources"); 100var addElement = new XElement("add");
dotnet-user-jwts (4)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
dotnet-user-secrets (4)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
GenerateDocumentationAndConfigFiles (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
ilc (10)
RdXmlRootProvider.cs (10)
22private XElement _documentRoot; 28_documentRoot = XElement.Load(rdXmlFileName); 33var libraryOrApplication = _documentRoot.Elements().Single(); 41foreach (var element in libraryOrApplication.Elements()) 55private void ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement) 77foreach (var element in assemblyElement.Elements()) 90private static void ProcessTypeDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, XElement typeElement) 126foreach (var element in typeElement.Elements()) 139private static void ProcessMethodDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, TypeDesc containingType, XElement methodElement) 147foreach (var element in methodElement.Elements())
illink (2)
ILLink.Tasks (2)
CombineLinkerXmlFiles.cs (2)
30var combined = new XElement("linker"); 35foreach (var element in subFile.Root.Elements())
Microsoft.Arcade.Common (3)
NupkgInfoFactory.cs (3)
54XElement metadataElement = GetSingleElement(doc.Root, "metadata"); 58private static XElement GetSingleElement(XElement el, string name)
Microsoft.AspNetCore.DataProtection (168)
_generated\0\LoggerMessage.g.cs (9)
329private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __ExceptionWhileProcessingRevocationElementCallback = 330global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Error, new global::Microsoft.Extensions.Logging.EventId(21, "ExceptionWhileProcessingRevocationElement"), "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 337public static partial void ExceptionWhileProcessingRevocationElement(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement revocationElement, global::System.Exception exception) 377private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __ExceptionWhileProcessingKeyElementCallback = 378global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Error, new global::Microsoft.Extensions.Logging.EventId(24, "ExceptionOccurredWhileProcessingTheKeyElement"), "An exception occurred while processing the key element '{Element}'.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 385public static partial void ExceptionWhileProcessingKeyElement(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement element, global::System.Exception exception) 393private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __AnExceptionOccurredWhileProcessingElementDebugCallback = 394global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Trace, new global::Microsoft.Extensions.Logging.EventId(25, "ExceptionOccurredWhileProcessingTheKeyElementDebug"), "An exception occurred while processing the key element '{Element}'.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 401public static partial void AnExceptionOccurredWhileProcessingElementDebug(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement element, global::System.Exception exception)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (2)
43var encryptionElement = new XElement("encryption", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 33var encryptionElement = element.Element("encryption")!; 39var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 35var encryptionElement = element.Element("encryption")!; 40var hashElement = element.Element("hash")!;
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializer.cs (3)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!;
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptor.cs (2)
18/// An <see cref="XmlSerializedDescriptorInfo"/> wrapping the <see cref="XElement"/> which represents the serialized 23/// element should be marked via the <see cref="XmlExtensions.MarkAsRequiresEncryption(XElement)" />
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptorDeserializer.cs (1)
19IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element);
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!; 38var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (3)
16/// <returns>The master key <see cref="XElement"/>.</returns> 17public static XElement ToMasterKeyElement(this ISecret secret) 37var masterKeyElement = new XElement("masterKey",
AuthenticatedEncryption\ConfigurationModel\XmlExtensions.cs (4)
11/// Data protection extensions for <see cref="XElement"/>. 15internal static bool IsMarkedAsRequiringEncryption(this XElement element) 21/// Marks the provided <see cref="XElement"/> as requiring encryption before being persisted 24public static void MarkAsRequiresEncryption(this XElement element)
AuthenticatedEncryption\ConfigurationModel\XmlSerializedDescriptorInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains the XML-serialized representation of an 21/// <param name="deserializerType">The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 23public XmlSerializedDescriptorInfo(XElement serializedDescriptorElement, Type deserializerType) 40/// The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 48public XElement SerializedDescriptorElement { get; }
Internal\KeyManagementOptionsPostSetup.cs (2)
99EncryptedXmlInfo IXmlEncryptor.Encrypt(XElement plaintextElement) 112public override void StoreElement(XElement element, string friendlyName)
KeyManagement\IKeyEscrowSink.cs (1)
25void Store(Guid keyId, XElement element);
KeyManagement\Internal\IInternalXmlKeyManager.cs (1)
27IAuthenticatedEncryptorDescriptor DeserializeDescriptorFromKeyElement(XElement keyElement);
KeyManagement\Key.cs (2)
63XElement keyElement, 223private static Func<IAuthenticatedEncryptorDescriptor> GetLazyDescriptorDelegate(IInternalXmlKeyManager keyManager, XElement keyElement)
KeyManagement\KeyEscrowServiceProviderExtensions.cs (1)
33public void Store(Guid keyId, XElement element)
KeyManagement\XmlKeyManager.cs (13)
178private object?[] ProcessAllElements(IReadOnlyCollection<XElement> allElements, out DateTimeOffset? mostRecentMassRevocationDate) 190foreach (var element in allElements) 288private Key? ProcessKeyElement(XElement keyElement) 344private object ProcessRevocationElement(XElement revocationElement) 387var revocationElement = new XElement(RevocationElementName, 490private void WriteKeyDeserializationErrorToLog(Exception error, XElement keyElement) 524var keyElement = new XElement(KeyElementName, 550var possiblyEncryptedKeyElement = KeyEncryptor?.EncryptIfNecessary(keyElement) ?? keyElement; 571IAuthenticatedEncryptorDescriptor IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement) 576var descriptorElement = keyElement.Element(DescriptorElementName); 580var unencryptedInputToDeserializer = descriptorElement.Elements().Single().DecryptElement(_activator); 632var revocationElement = new XElement(RevocationElementName, 730public void Store(Guid keyId, XElement element)
LoggingExtensions.cs (3)
104public static partial void ExceptionWhileProcessingRevocationElement(this ILogger logger, XElement revocationElement, Exception exception); 113public static partial void ExceptionWhileProcessingKeyElement(this ILogger logger, XElement element, Exception exception); 116public static partial void AnExceptionOccurredWhileProcessingElementDebug(this ILogger logger, XElement element, Exception exception);
Repositories\EphemeralXmlRepository.cs (14)
19private readonly List<XElement> _storedElements = new List<XElement>(); 27public IReadOnlyCollection<XElement> GetAllElements() 36private IEnumerable<XElement> GetAllElementsCore() 39foreach (XElement element in _storedElements) 45public void StoreElement(XElement element, string friendlyName) 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 67foreach (var storedElement in _storedElements) 84var storedElement = deletableElement.StoredElement; 100public DeletableElement(XElement storedElement, XElement element) 107public XElement Element { get; } 109/// <summary>The <see cref="XElement"/> from which <see cref="Element"/> was cloned.</summary> 110public XElement StoredElement { get; }
Repositories\FileSystemXmlRepository.cs (9)
69public virtual IReadOnlyCollection<XElement> GetAllElements() 75private IEnumerable<XElement> GetAllElementsCore() 107private XElement ReadElementFromFile(string fullPath) 113return XElement.Load(fileStream); 118public virtual void StoreElement(XElement element, string friendlyName) 132private void StoreElementCore(XElement element, string filename) 189var element = ReadElementFromFile(fullPath); 221public DeletableElement(FileSystemInfo fileSystemInfo, XElement element) 228public XElement Element { get; }
Repositories\IDeletableElement.cs (1)
14public XElement Element { get; }
Repositories\IXmlRepository.cs (2)
20IReadOnlyCollection<XElement> GetAllElements(); 34void StoreElement(XElement element, string friendlyName);
Repositories\RegistryXmlRepository.cs (10)
56public virtual IReadOnlyCollection<XElement> GetAllElements() 62private IEnumerable<XElement> GetAllElementsCore() 72var element = ReadElementFromRegKey(RegistryKey, valueName); 127private XElement? ReadElementFromRegKey(RegistryKey regKey, string valueName) 132return (!string.IsNullOrEmpty(data)) ? XElement.Parse(data) : null; 136public virtual void StoreElement(XElement element, string friendlyName) 150private void StoreElementCore(XElement element, string valueName) 168var element = ReadElementFromRegKey(RegistryKey, valueName); 202public DeletableElement(string valueName, XElement element) 209public XElement Element { get; }
XmlEncryption\CertificateXmlEncryptor.cs (6)
59/// Encrypts the specified <see cref="XElement"/> with an X.509 certificate. 67public EncryptedXmlInfo Encrypt(XElement plaintextElement) 75var encryptedElement = EncryptElement(plaintextElement); 83private XElement EncryptElement(XElement plaintextElement) 98return XElement.Load(xmlDocument.DocumentElement.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\DpapiNGXmlDecryptor.cs (2)
47public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiNGXmlEncryptor.cs (3)
49/// Encrypts the specified <see cref="XElement"/>. 57public EncryptedXmlInfo Encrypt(XElement plaintextElement) 85var element = new XElement("encryptedKey",
XmlEncryption\DpapiXmlDecryptor.cs (2)
44public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiXmlEncryptor.cs (3)
42/// Encrypts the specified <see cref="XElement"/>. 50public EncryptedXmlInfo Encrypt(XElement plaintextElement) 82var element = new XElement("encryptedKey",
XmlEncryption\EncryptedXmlDecryptor.cs (3)
57public XElement Decrypt(XElement encryptedElement) 78return XElement.Load(xmlDocument.DocumentElement!.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\EncryptedXmlInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains a blob of encrypted XML 20/// <param name="decryptorType">The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> 22public EncryptedXmlInfo(XElement encryptedElement, Type decryptorType) 39/// The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> method can be used to 47public XElement EncryptedElement { get; }
XmlEncryption\IXmlDecryptor.cs (3)
19/// Implementations of this method must not mutate the <see cref="XElement"/> 22XElement Decrypt(XElement encryptedElement);
XmlEncryption\IXmlEncryptor.cs (3)
14/// Encrypts the specified <see cref="XElement"/>. 23/// Implementations of this method must not mutate the <see cref="XElement"/> 26EncryptedXmlInfo Encrypt(XElement plaintextElement);
XmlEncryption\NullXmlDecryptor.cs (2)
21public XElement Decrypt(XElement encryptedElement)
XmlEncryption\NullXmlEncryptor.cs (3)
36/// Encrypts the specified <see cref="XElement"/> with a null encryptor, i.e., 45public EncryptedXmlInfo Encrypt(XElement plaintextElement) 56var newElement = new XElement("unencryptedKey",
XmlEncryption\XmlEncryptionExtensions.cs (22)
19public static XElement DecryptElement(this XElement element, IActivator activator) 35var placeholderReplacements = new Dictionary<XElement, XElement>(); 39var elementWhichRequiresDecryption = doc.Descendants(XmlConstants.EncryptedSecretElementName).FirstOrDefault(); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 52var decryptedElement = decryptorInstance.Decrypt(clonedElementWhichRequiresDecryption.Elements().Single()); 56var newPlaceholder = new XElement("placeholder"); 101public static XElement? EncryptIfNecessary(this IXmlEncryptor encryptor, XElement element) 117var placeholderReplacements = new Dictionary<XElement, EncryptedXmlInfo>(); 121var elementWhichRequiresEncryption = doc.Descendants().FirstOrDefault(DoesSingleElementRequireEncryption); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 158/// Converts an <see cref="XElement"/> to a <see cref="Secret"/> so that it can be kept in memory 161public static Secret ToSecret(this XElement element) 182/// Converts a <see cref="Secret"/> back into an <see cref="XElement"/>. 184public static XElement ToXElement(this Secret secret) 193return XElement.Load(memoryStream); 202private static bool DoesElementOrDescendentRequireDecryption(XElement element) 207private static bool DoesElementOrDescendentRequireEncryption(XElement element) 212private static bool DoesSingleElementRequireEncryption(XElement element)
XmlExtensions.cs (3)
19public static XElement WithoutChildNodes(this XElement element) 21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.OpenApi.SourceGenerators (24)
XmlCommentGenerator.Parser.cs (3)
51XElement xml; 54xml = XElement.Parse(text.ToString()); 62foreach (var member in members)
XmlComments\XmlComment.cs (7)
70foreach (var element in listElements) 101foreach (var element in codeElements) 115foreach (var element in paramRefElements) 130foreach (var element in typeParamRefElements) 148foreach (var element in paraElements) 188foreach (var item in nodes) 220foreach (var item in nodes)
XmlComments\XmlComment.InheritDoc.cs (14)
43var element = XElement.Parse(xmlText, LoadOptions.PreserveWhitespace); 110var element = (XElement)node; 142private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken) 232foreach (var typeParameterRef in typeParameterRefs) 247var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 345static string BuildXPathForElement(XElement element) 354for (var current = element; current != null; current = current.Parent) 370private static bool ElementNameIs(XElement element, string name) 402var sourceElement = (XElement)(object)node; 403var targetElement = (XElement)copy;
Microsoft.AspNetCore.Rewrite (20)
IISUrlRewrite\InvalidUrlRewriteFormatException.cs (3)
14public InvalidUrlRewriteFormatException(XElement element, string message) 19public InvalidUrlRewriteFormatException(XElement element, string message, Exception innerException) 27private static string FormatMessage(XElement element, string message)
IISUrlRewrite\RewriteMapParser.cs (4)
11public static IISRewriteMapCollection? Parse(XElement xmlRoot) 15var mapsElement = xmlRoot.Descendants(RewriteTags.RewriteMaps).SingleOrDefault(); 22foreach (var mapElement in mapsElement.Elements(RewriteTags.RewriteMap)) 25foreach (var addElement in mapElement.Elements(RewriteTags.Add))
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.Build.Tasks.Core (23)
AssemblyDependency\GenerateBindingRedirects.cs (11)
77XElement runtimeNode = doc.Root 79.OfType<XElement>() 198private void UpdateExistingBindingRedirects(XElement runtimeNode, IDictionary<AssemblyName, string> redirects) 203.OfType<XElement>() 206foreach (var assemblyBinding in assemblyBindingNodes) 210.OfType<XElement>() 213foreach (var dependentAssembly in dependentAssemblies) 215var assemblyIdentity = dependentAssembly 217.OfType<XElement>() 228var bindingRedirect = dependentAssembly 230.OfType<XElement>()
AssemblyDependency\ResolveAssemblyReference.cs (1)
1388var node = new XElement(
CombineTargetFrameworkInfoProperties.cs (1)
49XElement root = UseAttributeForTargetFrameworkInfoPropertyNames ?
CombineXmlElements.cs (2)
37XElement root = new XElement(RootElementName); 41root.Add(XElement.Parse(item.ItemSpec));
GenerateResource.cs (1)
3054foreach (XElement dataElem in doc.Element("root").Elements("data"))
ResourceHandling\MSBuildResXReader.cs (4)
34foreach (XElement elem in doc.Element("root").Elements()) 58private static void ParseAssemblyAlias(Dictionary<string, string> aliases, XElement elem) 116XElement elem, 124XElement valueElement = elem.Element("value");
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (3)
347XElement codeElement = null; 357XElement child = (XElement)node;
Microsoft.CodeAnalysis (17)
InternalUtilities\XmlUtilities.cs (5)
45var sourceElement = ((XElement)(object)node); 46var targetElement = ((XElement)copy); 68internal static XElement[]? TrySelectElements(XNode node, string xpath, out string? errorMessage, out bool invalidXPath)
RuleSet\RuleSetProcessor.cs (12)
66XElement? ruleSetNode = null; 81List<XElement> nodeList = ruleSetDocument.Elements(RuleSetNodeName).ToList(); 96private static RuleSet ReadRuleSet(XElement ruleSetNode, string filePath) 106foreach (XElement childNode in ruleSetNode.Elements()) 149private static List<KeyValuePair<string, ReportDiagnostic>> ReadRules(XElement rulesNode) 157foreach (XElement ruleNode in rulesNode.Elements()) 178private static KeyValuePair<string, ReportDiagnostic> ReadRule(XElement ruleNode) 191private static RuleSetInclude ReadRuleSetInclude(XElement includeNode) 205private static ReportDiagnostic ReadAction(XElement node, bool allowDefault) 242private static ReportDiagnostic ReadIncludeAll(XElement includeAllNode) 253private static string ReadNonEmptyAttribute(XElement node, string attributeName) 287private static void ValidateAttribute(XElement node, string attributeName)
Microsoft.CodeAnalysis.Analyzers (46)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (1)
76foreach (var dataElement in parsedDocument.Descendants("data"))
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.AnalyzerUtilities (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.CodeStyle (38)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
Microsoft.CodeAnalysis.CSharp (8)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (8)
179XElement element = (XElement)node; 215XElement element = (XElement)container; 252private static bool ElementNameIs(XElement element, string name) 266private XNode[] RewriteIncludeElement(XElement includeElement, string currentXmlFilePath, CSharpSyntaxNode originatingSyntax, out string commentMessage) 355XElement[] loadedElements = XmlUtilities.TrySelectElements(doc, xpathValue, out errorMessage, out invalidXPath); 464private Location GetIncludeElementLocation(XElement includeElement, ref string currentXmlFilePath, ref CSharpSyntaxNode originatingSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.Features (8)
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (7)
278var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 310var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 340var element = (XElement)node; 465private static (string target, string hint)? GetNavigationTarget(XElement element, SemanticModel semanticModel, int position, SymbolDisplayFormat format)
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
Microsoft.CodeAnalysis.ResxSourceGenerator (46)
AbstractResxGenerator.cs (1)
444foreach (var node in XDocument.Load(new SourceTextReader(text)).Descendants("data"))
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
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.Workspaces (83)
CodeStyle\CodeStyleOption.cs (3)
18XElement ToXElement(); 61public XElement ToXElement() => UnderlyingOption.ToXElement(); 63public static CodeStyleOption<T> FromXElement(XElement element)
Log\WorkspaceStructureLogger.cs (28)
40var workspaceElement = new XElement("workspace"); 54var projectElement = await BuildProjectElementAsync(project, cancellationToken).ConfigureAwait(false); 57var msbuildReferencesElement = CreateMsBuildReferencesElement(project); 71var workspaceAnalyzerReferencesElement = new XElement("workspaceAnalyzerReferences"); 89var generatorDiagnosticsElement = new XElement("generatorDiagnostics"); 109protected virtual Task<IEnumerable<XElement>> CreateAdditionalProjectElementsAsync(Project project, CancellationToken cancellationToken) 110=> Task.FromResult<IEnumerable<XElement>>([]); 112private static async Task<XElement> BuildProjectElementAsync(Project project, CancellationToken cancellationToken) 114var projectElement = new XElement("project"); 129private static XElement? CreateMsBuildReferencesElement(Project project) 137var msbuildReferencesElement = new XElement("msbuildReferences"); 146private XElement BuildWorkspaceReferencesElement(Project project) 148var workspaceReferencesElement = new XElement("workspaceReferences"); 155var referenceElement = new XElement("projectReference", new XAttribute("id", SanitizePath(projectReference.ProjectId.ToString()))); 166private async Task AddCompilationElementsAsync(XElement projectElement, Project project, CancellationToken cancellationToken) 172var compilationReferencesElement = new XElement("compilationReferences"); 180var diagnosticsElement = new XElement("diagnostics"); 189private static XElement CreateElementForDiagnostic(Diagnostic diagnostic) 196private static IEnumerable<XElement> CreateElementsForSourceGeneratedDocuments(IEnumerable<SourceGeneratedDocument> documents) 198var elements = new List<XElement>(); 203var element = new XElement("sourceGeneratedDocument", 240internal XElement CreateElementForPortableExecutableReference(MetadataReference reference) 263private static XElement CreateElementForAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference reference) 268private XElement CreateElementForCompilation(Compilation compilation) 274var typesElement = new XElement("types"); 295internal static async Task<IEnumerable<XElement>> CreateElementsForDocumentCollectionAsync(IEnumerable<TextDocument> documents, string elementName, CancellationToken cancellationToken) 297var elements = new List<XElement>(); 301var documentElement = new XElement(elementName, new XAttribute("path", SanitizePath(document.FilePath)));
Shared\Extensions\ISymbolExtensions.cs (14)
243var element = XElement.Parse(xmlText, LoadOptions.PreserveWhitespace); 301var element = (XElement)node; 344private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken) 426foreach (var typeParameterRef in typeParameterRefs) 439var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 537static string BuildXPathForElement(XElement element) 546for (var current = element; current != null; current = current.Parent) 591var sourceElement = (XElement)(object)node; 592var targetElement = (XElement)copy; 633private static bool ElementNameIs(XElement element, string name)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.DotNet.Arcade.Sdk (3)
src\ExtractNgenMethodList.cs (2)
55var parentElement = document.Root.Element("MethodProfilingData"); 58foreach (var child in parentElement.Elements("Item"))
src\GenerateResxSource.cs (1)
106foreach (var node in XDocument.Load(ResourceFile).Descendants("data"))
Microsoft.DotNet.Build.Manifest (17)
ArtifactModel.cs (1)
13public abstract XElement ToXml();
ArtifactSet.cs (2)
26public IEnumerable<XElement> ToXml() => Packages 37public static ArtifactSet Parse(XElement xml) => new ArtifactSet
AssetManifestModel.cs (1)
16public override XElement ToXml() => throw new NotImplementedException();
BlobArtifactModel.cs (2)
17public override XElement ToXml() => new XElement( 23public static BlobArtifactModel Parse(XElement xml) => new BlobArtifactModel
BuildIdentity.cs (2)
259public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes()); 261public static BuildIdentity Parse(XElement xml) => new BuildIdentity
BuildModel.cs (2)
26public XElement ToXml() => new XElement( 31public static BuildModel Parse(XElement xml) => new BuildModel(BuildIdentity.Parse(xml))
BuildModelFactory.cs (1)
189return BuildModel.Parse(XElement.Load(stream));
PackageArtifactModel.cs (2)
60public override XElement ToXml() => new XElement( 66public static PackageArtifactModel Parse(XElement xml) => new PackageArtifactModel
PdbArtifactModel.cs (2)
29public override XElement ToXml() => new XElement( 35public static PdbArtifactModel Parse(XElement xml) => new PdbArtifactModel
XElementParsingExtensions.cs (2)
13public static string GetRequiredAttribute(this XElement element, XName name) 24public static Dictionary<string, string> CreateAttributeDictionary(this XElement element)
Microsoft.DotNet.Build.Tasks.Installers (11)
src\CreateWixBuildWixpack.cs (1)
551foreach (var element in elements)
src\CreateWixCommandPackageDropBase.cs (4)
245IEnumerable<XElement> iels = doc.XPathSelectElements(xpath, nsmgr); 249foreach (XElement row in iels) 251IEnumerable<XElement> fields = row.XPathSelectElements("wix:field", nsmgr); 265foreach (XElement field in fields)
src\GenerateMacOSDistributionFile.cs (5)
41var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 62var scriptElement = new XElement("script", new XCData(archScriptContent)); 94var optionsElement = document.Root.Element("options"); 134public static XElement WithAttribute(this XElement element, XName attribute, object value)
src\StabilizeWixFileId.cs (1)
67XElement[] matchingFileElements = content.Element(GetQualifiedName("Wix"))
Microsoft.DotNet.Build.Tasks.Packaging (2)
GenerateNuSpec.cs (1)
164var licenseUrlElement = nuspec.Descendants(NuSpecXmlNamespace + "licenseUrl").Single();
PackageIndex.cs (1)
217foreach (var file in frameworkList.Element("FileList").Elements("File"))
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\FinalizeInsertionVsixFile.cs (1)
79var installationElement = document.Element(XName.Get("PackageManifest", VsixNamespace))?.Element(XName.Get("Installation", VsixNamespace));
Microsoft.DotNet.HotReload.Watch (1)
HotReload\HotReloadDotNetWatcher.cs (1)
1127var solutionElement = new XElement("Solution");
Microsoft.DotNet.MacOsPkg.Core (7)
Package.cs (7)
56var xml = XElement.Load(distribution); 57List<XElement> componentPackages = xml.Elements("pkg-ref").Where(e => e.Value.Trim() != "").ToList(); 58foreach (var package in componentPackages) 158XElement pkgInfo = XElement.Load(packageInfo); 201private static string GetPackageInfoAttribute(XElement pkgInfo, string elementName) =>
Microsoft.DotNet.NuGetRepack.Tasks (10)
src\NuGetVersionUpdater.cs (8)
149var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 161var versionElement = metadata.Element(XName.Get("version", nuspecXmlns)); 264private static bool IsDotnetTool(string nuspecXmlns, XElement metadata) 266var packageTypesElement = metadata.Element(XName.Get("packageTypes", nuspecXmlns)); 269foreach (var packageType in packageTypesElement.Elements(XName.Get("packageType", nuspecXmlns)) ?? Array.Empty<XElement>()) 293Descendants(XName.Get("dependency", package.NuspecXmlns)) ?? Array.Empty<XElement>(); 295foreach (var dependency in dependencies)
src\ReplacePackageParts.cs (2)
142var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 156var versionElement = metadata.Element(XName.Get("version", nuspecXmlns));
Microsoft.DotNet.PackageTesting (4)
VerifyClosure.cs (4)
347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 396private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
Microsoft.DotNet.SharedFramework.Sdk (6)
src\arcade\src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (4)
347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 396private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
src\CreateFrameworkListFile.cs (2)
67var frameworkManifest = new XElement("FileList", rootAttributes); 158var element = new XElement(
Microsoft.DotNet.SourceBuild.Tasks (17)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (2)
30public XElement ToXml() => new XElement( 38public static Usage Parse(XElement xml) => new Usage
src\UsageReport\UsageData.cs (2)
18public XElement ToXml() => new XElement( 43public static UsageData Parse(XElement xml) => new UsageData
src\UsageReport\UsagePattern.cs (2)
15public XElement ToXml() => new XElement( 20public static UsagePattern Parse(XElement xml) => new UsagePattern
src\UsageReport\UsageValidationData.cs (1)
13public XElement Report { get; set; }
src\UsageReport\WriteUsageReports.cs (7)
63UsageData data = UsageData.Parse(XElement.Parse(File.ReadAllText(DataFile))); 81var xml = XElement.Parse(File.ReadAllText(ProdConBuildManifestFile)); 82foreach (var x in xml.Descendants("Package")) 107var report = new XElement("AnnotatedUsages"); 178Xml = XElement.Parse(content) 244public static PackageVersionPropsElement[] Parse(XElement xml)
src\UsageReport\XmlParsingHelpers.cs (2)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement( 26public static PackageIdentity ParsePackageIdentity(XElement xml) => new PackageIdentity(
Microsoft.DotNet.XliffTasks (61)
Model\ResxDocument.cs (4)
18foreach (XElement node in Document.Descendants("data")) 27XElement valueElement = node.Element("value"); 59foreach (XElement node in Document.Descendants("data")) 63XElement valueNodeOfFileRef = node.Element("value");
Model\TranslatableXmlDocument.cs (2)
29private readonly XElement _element; 31public TranslatableXmlElement(string id, string source, string note, XElement element)
Model\VsctDocument.cs (4)
20foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 31foreach (XElement child in strings.Elements()) 64foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 79foreach (XElement imageTag in Document.Descendants(Document.Root.Name.Namespace + "Bitmap"))
Model\XamlRuleDocument.cs (11)
27foreach (XElement? element in Document.Descendants()) 30var descendentDisplayName = element.Elements(XName.Get($"{element.Name.LocalName}.DisplayName", element.Name.NamespaceName)).FirstOrDefault(); 31var descendentDescription = element.Elements(XName.Get($"{element.Name.LocalName}.Description", element.Name.NamespaceName)).FirstOrDefault(); 125var parent = xObject.Parent; 133var grandparent = parent.Parent; 145private static string GenerateIdForPropertyMetadata(XElement element, XAttribute? attribute = null) 147var ancestorWithNameAttributeCandidate = element.Parent?.Parent; // start at grandparent 194private static string? GetComment(XElement element, string attributeName) 210private static string XmlName(XObject container) => container is XElement element ? XmlName(element) : XmlName((XAttribute)container); 211private static string XmlName(XElement element) 220private static string? AttributedName(XElement element) => element.Attribute("Name")?.Value;
Model\XDocumentExtensions.cs (1)
28public static void SelfCloseIfPossible(this XElement element)
Model\XElementExtensions.cs (24)
16/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 19public static string GetTargetValue(this XElement transUnitElement) => 27/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 29public static void SetTargetValue(this XElement transUnitElement, string value) 31XElement targetElement = transUnitElement.Element(Target); 34XElement sourceElement = transUnitElement.Element(Source); 51/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 53public static string GetTargetState(this XElement transUnitElement) => 61/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 63public static void SetTargetState(this XElement transUnitElement, string value) 65XElement targetElement = transUnitElement.Element(Target); 68XElement sourceElement = transUnitElement.Element(Source); 88/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 90public static string GetSourceValue(this XElement transUnitElement) => 96/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 98public static void SetSourceValue(this XElement transUnitElement, string value) => 104/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 106public static string GetNoteValue(this XElement transUnitElement) => 114/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 116public static void SetNoteValue(this XElement transUnitElement, string value) 118XElement noteElement = transUnitElement.Element(Note); 121XElement priorElement = transUnitElement.Element(Target) ?? transUnitElement.Element(Source); 133/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 135public static string GetId(this XElement transUnitElement) =>
Model\XlfDocument.cs (13)
89XElement fileElement = _document.Root.Element(File); 98XElement bodyElement = fileElement.Element(Body); 99XElement groupElement = bodyElement.Element(Group); 108foreach (XElement unitElement in bodyElement.Descendants(TransUnit).ToList()) 187XElement newTransUnit = 195foreach (XElement transUnit in bodyElement.Elements(TransUnit)) 226XElement fileElement = _document.Root.Element(File); 227XElement bodyElement = fileElement.Element(Body); 229IEnumerable<XElement> transUnits = bodyElement.Elements(TransUnit); 235SortedList<string, XElement> sortedTransUnits = new(comparer); 238foreach (XElement transUnit in transUnits) 244foreach (XElement transUnit in sortedTransUnits.Values) 264foreach (XElement element in _document.Descendants(TransUnit))
Tasks\TransformTemplates.cs (2)
77foreach (XElement projectNode in templateXml.Descendants().Where(d => d.Name.LocalName == "Project")) 84foreach (XElement templateItem in templateXml.Descendants().Where(d => d.Name.LocalName == "ProjectItem"))
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
1313[JsonSerializable(typeof(XElement))]
Microsoft.Extensions.AI.Evaluation.Safety (2)
ContentSafetyServicePayloadUtilities.cs (2)
102IEnumerable<List<XElement>> userTextListItems = 108List<XElement> item = [];
Microsoft.Extensions.FileProviders.Embedded (11)
Manifest\ManifestParser.cs (11)
38var manifest = EnsureElement(document, "Manifest"); 39var manifestVersion = EnsureElement(manifest, "ManifestVersion"); 47var fileSystem = EnsureElement(manifest, "FileSystem"); 51foreach (var element in entries) 80private static ManifestEntry BuildEntry(XElement element) 92var path = EnsureElement(element, "ResourcePath"); 101foreach (var child in element.Elements()) 115private static XElement EnsureElement(XContainer container, string elementName) 117var element = container.Element(elementName); 126private static string EnsureName(XElement element) 137private static string EnsureText(XElement element)
Microsoft.Maui.Resizetizer (22)
GeneratePackageAppxManifest.cs (10)
81 var identity = appx.Root.Element(xidentity); 125 var properties = appx.Root.Element(xproperties); 136 var xelem = properties.Element(xname); 145 var xelem = properties.Element(xname); 171 var applications = appx.Root.Element(xapplications); 180 var application = applications.Element(xapplication); 189 var visual = application.Element(xvisual); 252 var tile = visual.Element(xtile); 309 var showname = tile.Element(xshowname); 328 var splash = visual.Element(xsplash);
GenerateTizenManifest.cs (12)
84 var manifest = tizenManifest.Root; 85 var uiApplication = manifest.Element(xmlns + UiApplicationName); 97 void UpdateSharedManifest(XNamespace xmlns, XElement manifest) 99 var uiApplication = manifest.Element(xmlns + UiApplicationName); 122 var label = uiApplication.Element(xmlns + LabelName); 132 void UpdateSharedResources(XNamespace xmlns, XElement manifestElement) 134 var uiApplicationElement = manifestElement.Element(xmlns + UiApplicationName); 143 foreach (var icon in iconPlaceholderElements) 162 var splashscreensElement = uiApplicationElement.Element(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName); 190 void UpdateElementAttribute(XElement element, XName attrName, string? value, string? placeholder) 199 void UpdateElementValue(XElement element, string? value, string? placeholder)
Microsoft.ML.Maml (2)
HelpCommand.cs (2)
463var content = new XElement("Components", 494private XElement CreateDefaultValueElement(IChannel ch, string name, CmdParser.ArgInfo.Arg a)
Microsoft.NET.Build.Tasks (20)
GenerateToolsSettingsFile.cs (4)
67XElement runtimeIdentifierPackagesNode = null; 68XElement commandNode = new XElement("Command", 80var packageNode = new XElement("RuntimeIdentifierPackage"); 97var dotnetCliToolNode = new XElement("DotNetCliTool",
ResolveRuntimePackAssets.cs (1)
184foreach (var fileElement in frameworkListDoc.Root.Elements("File"))
ResolveTargetingPackAssets.cs (3)
326foreach (var fileElement in frameworkListDoc.Root.Elements("File")) 417var firstFileElement = frameworkListDoc.Root.Elements("File").FirstOrDefault(); 432private static string GetDllPathViaAssemblyName(string targetingPackDllFolder, XElement fileElement)
src\sdk\src\Tasks\Common\ConflictResolution\FrameworkListReader.cs (1)
67foreach (var file in frameworkList.Root?.Elements("File") ?? [])
StoreArtifactParser.cs (1)
29foreach (var pkginfo in doc.Root.Elements(ns + "Package"))
ValidateExecutableReferences.cs (4)
42var additionalPropertiesXml = XElement.Parse(project.GetMetadata("AdditionalPropertiesFromProject")); 43XElement targetFrameworkElement = UseAttributeForTargetFrameworkInfoPropertyNames ? 47foreach (XElement propertyElement in targetFrameworkElement.Elements())
WriteAppConfigWithSupportedRuntime.cs (6)
55XElement startupNode = doc.Root 57.OfType<XElement>() 68out XElement supportedRuntime)) 81private static bool HasExistingSupportedRuntime(XElement startupNode) 84&& startupNode.Nodes().OfType<XElement>().Any(e => e.Name.LocalName == "supportedRuntime"); 93out XElement supportedRuntime)
Microsoft.NET.HostModel (7)
ComHost\RegFreeComManifest.cs (7)
30XElement manifest = new XElement(ns + "assembly", new XAttribute("manifestVersion", "1.0")); 36var fileElement = CreateComHostFileElement(clsidMapPath, comHostName, ns); 54private static XElement CreateComHostFileElement(string clsidMapPath, string comHostName, XNamespace ns) 56XElement fileElement = new XElement(ns + "file", new XAttribute("name", comHostName)); 67XElement comClassElement = new XElement(ns + "comClass", new XAttribute("clsid", guid.ToString("B")), new XAttribute("threadingModel", "Both")); 78private static void AddTypeLibElementsToFileElement(IReadOnlyDictionary<int, string> typeLibraries, XNamespace ns, XElement fileElement) 90XElement typeLibElement = new XElement(ns + "typelib",
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (2)
BlazorWriteSatelliteAssemblyFile.cs (1)
28var root = new XElement("SatelliteAssembly");
CreateBlazorTrimmerRootDescriptorFile.cs (1)
41var roots = new XElement("linker");
Microsoft.NET.Sdk.Publish.Tasks (18)
Tasks\GenerateEnvTransform.cs (1)
76var envVariableTransform =
WebConfigTransform.cs (17)
21XElement? rootElement = null; 24var firstAspNetCoreElement = webConfig.Root?.Descendants(aspNetCoreElementName).FirstOrDefault(); 34var webServerSection = GetOrCreateChild(rootElement, "system.webServer"); 36var handlerSection = GetOrCreateChild(webServerSection, HandlersElementName); 45var aspNetCoreSection = GetOrCreateChild(webServerSection, aspNetCoreElementName); 53var aspNetCoreElement = webServerSection?.Element(HandlersElementName)? 64private static void TransformHandlers(XElement handlersElement, string? aspNetCoreModuleName) 66var aspNetCoreElement = 89private static void TransformAspNetCore(XElement aspNetCoreElement, string appName, bool configureForAzure, bool useAppHost, string? extension, string? aspNetCoreModuleName, string? aspNetCoreHostingModelValue, string? projectFullPath) 171private static void SetAspNetCoreHostingModel(string? aspNetCoreHostingModelValue, string? aspNetCoreModuleName, XElement aspNetCoreElement) 194private static void TransformEnvironmentVariables(XElement envVariablesElement, string? environmentName) 196var envVariableElement = 210private static XElement GetOrCreateChild(XElement? parent, string childName) 212var childElement = parent?.Element(childName); 221private static void SetAttributeValueIfEmpty(XElement element, string attributeName, string? value) 226private static void RemoveLauncherArgs(XElement aspNetCoreElement)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (13)
GeneratePackageAssetsTargetsFile.cs (3)
32var itemGroup = new XElement("ItemGroup"); 33var manifestItem = new XElement("StaticWebAssetPackageManifest", 42var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetEndpointsPropsFile.cs (2)
44var itemGroup = new XElement("ItemGroup"); 63var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetsPropsFile.cs (2)
79var itemGroup = new XElement("ItemGroup"); 128var root = new XElement("Project", itemGroup);
Legacy\GenerateStaticWebAssetsPropsFile50.cs (2)
56var itemGroup = new XElement("ItemGroup"); 81var root = new XElement("Project", itemGroup);
Legacy\GenerateV1StaticWebAssetsManifest.cs (3)
38var root = new XElement( 100private IEnumerable<XElement> CreateNodes() 102var nodes = new List<XElement>();
StaticWebAssetsGeneratePackagePropsFile.cs (1)
27var root = new XElement("Project");
Microsoft.TestPlatform.CrossPlatEngine (1)
TestEngine.cs (1)
722XElement? targetFrameworkTestHostDemultiplexer = document?.Element("RunSettings")?.Element("RunConfiguration")?.Element("TargetFrameworkTestHostDemultiplexer");
Microsoft.VisualStudio.TestPlatform.Common (3)
ExtensionDecorators\SerialTestRunDecorator.cs (3)
95XElement runSettings = XElement.Parse(runContext.RunSettings.SettingsXml); 96XElement? forceOneTestAtTimePerTestHost = runSettings.Element("RunConfiguration")?.Element("ForceOneTestAtTimePerTestHost");
netstandard (1)
netstandard.cs (1)
2273[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
NuGet.Commands (12)
RestoreCommand\MSBuildRestoreItemGroup.cs (3)
30public List<XElement> Items { get; set; } = new List<XElement>(); 69IEnumerable<XElement> items,
RestoreCommand\Utility\BuildAssetsUtils.cs (9)
242public static XElement GenerateProperty(string propertyName, string content) 249internal static XElement GenerateItem(string itemName, string path) 254public static XElement GenerateImport(string path) 261public static XElement GenerateContentFilesItem(string path, LockFileContentFile item, string packageId, string packageVersion) 263var entry = new XElement(Namespace + item.BuildAction.Value, 331var itemGroup = new XElement(Namespace + group.RootName, group.Items); 703var import = GenerateImport(pathWithMacros); 728var import = GenerateImport(pathWithMacros); 912private static XElement GeneratePackagePathProperty(LocalPackageInfo localPackageInfo)
NuGet.Configuration (65)
Settings\Items\AddItem.cs (1)
44internal AddItem(XElement element, SettingsFile origin)
Settings\Items\AuthorItem.cs (3)
23internal AuthorItem(XElement element, SettingsFile origin) 42if (Node is XElement) 47var element = new XElement(ElementName);
Settings\Items\CertificateItem.cs (1)
79internal CertificateItem(XElement element, SettingsFile origin)
Settings\Items\ClearItem.cs (1)
18internal ClearItem(XElement element, SettingsFile origin)
Settings\Items\ClientCertItem.cs (1)
25internal ClientCertItem(XElement element, SettingsFile origin)
Settings\Items\CredentialsItem.cs (5)
140internal CredentialsItem(XElement element, SettingsFile origin) 217if (Node is XElement) 223var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), 294var element = Node as XElement;
Settings\Items\FileClientCertItem.cs (3)
53internal FileClientCertItem(XElement element, SettingsFile origin) 142if (Node is XElement) 147var element = new XElement(ElementName);
Settings\Items\OwnersItem.cs (5)
38internal OwnersItem(XElement element, SettingsFile origin) 41var descendants = element.Nodes().Where(n => n is XText text && !string.IsNullOrWhiteSpace(text.Value) || n is XElement) 69if (Node is XElement) 76var element = new XElement(ElementName, _content.AsXNode()); 128((XElement)Node).Add(_content.Node);
Settings\Items\PackagePatternItem.cs (1)
34internal PackagePatternItem(XElement element, SettingsFile origin)
Settings\Items\PackageSourceMappingSourceItem.cs (5)
75internal PackageSourceMappingSourceItem(XElement element, SettingsFile origin) 78var parsedDescendants = element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 127if (Node is XElement) 132var element = new XElement(ElementName); 191XElementUtility.AddIndented(Node as XElement, itemToAdd.Node);
Settings\Items\RepositoryItem.cs (5)
59internal RepositoryItem(XElement element, SettingsFile origin) 64internal RepositoryItem(XElement element, SettingsFile origin, IEnumerable<SettingBase> parsedDescendants) 106if (Node is XElement) 111var element = new XElement(ElementName); 191XElementUtility.AddIndented(Node as XElement, _owners.Node);
Settings\Items\SourceItem.cs (1)
84internal SourceItem(XElement element, SettingsFile origin)
Settings\Items\StoreClientCertItem.cs (3)
72internal StoreClientCertItem(XElement element, SettingsFile origin) 217if (Node is XElement) 222var element = new XElement(ElementName);
Settings\Items\TrustedSignerItem.cs (6)
53internal TrustedSignerItem(XElement element, SettingsFile origin) 56IEnumerable<SettingBase> parsedDescendants = element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 70internal TrustedSignerItem(XElement element, SettingsFile origin, IEnumerable<SettingBase> parsedDescendants) 84internal static IEnumerable<SettingBase> ParseDescendants(XElement element, SettingsFile origin) 86return element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 154XElementUtility.AddIndented(Node as XElement, certToAdd.Node);
Settings\Items\UnknownItem.cs (5)
23internal UnknownItem(XElement element, SettingsFile origin) 29var descendants = element.Nodes().Where(n => n is XText text && !string.IsNullOrWhiteSpace(text.Value) || n is XElement) 102XElementUtility.AddIndented(Node as XElement, setting.Node); 150if (Node is XElement) 155var element = new XElement(ElementName, Children.Select(c => c.AsXNode()));
Settings\NuGetConfiguration.cs (1)
62internal NuGetConfiguration(XElement element, SettingsFile origin)
Settings\ParsedSettingSection.cs (1)
12internal ParsedSettingSection(string name, XElement element, SettingsFile origin)
Settings\SettingElement.cs (4)
100internal SettingElement(XElement element, SettingsFile origin) 115if (Node != null && Node is XElement) 120var element = new XElement(ElementName); 234private void ValidateAttributes(XElement element, SettingsFile origin)
Settings\SettingFactory.cs (2)
26if (node is XElement element) 153internal static IEnumerable<T> ParseChildren<T>(XElement xElement, SettingsFile origin, bool canBeCleared) where T : SettingElement
Settings\SettingItem.cs (3)
28internal SettingItem(XElement element, SettingsFile origin) 64var xElement = Node as XElement;
Settings\SettingSection.cs (1)
27internal SettingSection(string name, XElement element, SettingsFile origin)
Settings\SettingsGroup.cs (4)
42internal SettingsGroup(string name, XElement element, SettingsFile origin) 57if (Node is XElement) 62var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), Children.Select(c => c.AsXNode())); 121XElementUtility.AddIndented(Node as XElement, setting.Node);
Utility\XElementUtility.cs (3)
12internal static string? GetOptionalAttributeValue(XElement element, string localName) 18internal static string? GetOptionalAttributeValue(XElement element, string localName, string namespaceName) 96foreach (var element in container.Elements())
NuGet.PackageManagement (53)
FileModifiers\XmlTransformer.cs (12)
23private readonly IDictionary<XName, Action<XElement, XElement>> _nodeActions; 31public XmlTransformer(IDictionary<XName, Action<XElement, XElement>> nodeActions) 74var xmlFragment = await GetXmlAsync(streamTaskFactory, projectSystem, cancellationToken); 119var xmlFragment = await GetXmlAsync(streamTaskFactory, projectSystem, cancellationToken); 127var elements = new List<XElement>(); 134var mergedFragments = elements.Aggregate( 151private static async Task<XElement> GetXmlAsync( 173return XElement.Parse(content, LoadOptions.PreserveWhitespace); 176private static async Task<XElement> GetXmlAsync( 183return XElement.Parse(content, LoadOptions.PreserveWhitespace);
Projects\MSBuildNuGetProject.cs (4)
629private static IDictionary<XName, Action<XElement, XElement>> GetConfigMappings() 634return new Dictionary<XName, Action<XElement, XElement>>
Utility\XElementExtensions.cs (37)
18public static string GetOptionalAttributeValue(this XElement element, string localName, string namespaceName = null) 34XElement child; 46public static IEnumerable<XElement> ElementsNoNamespace(this XContainer container, string localName) 51public static IEnumerable<XElement> ElementsNoNamespace(this IEnumerable<XContainer> source, string localName) 57public static XElement Except(this XElement source, XElement target) 86var sourceChild = sourceChildNode as XElement; 89var targetChild = FindElement(target, sourceChild); 107public static XElement MergeWith(this XElement source, XElement target) 113public static XElement MergeWith(this XElement source, XElement target, IDictionary<XName, Action<XElement, XElement>> nodeActions) 143var targetChild = targetChildNode as XElement; 146var sourceChild = FindElement(source, targetChild); 161Action<XElement, XElement> nodeAction; 172var newlyAddedElement = source.Elements().Last(); 187private static XElement FindElement(XElement source, XElement targetChild) 198private static bool HasComment(XElement element, XComment comment) 204private static int Compare(XElement target, XElement left, XElement right) 224private static int CountMatches(XElement left, XElement right, Func<XAttribute, XAttribute, bool> matcher) 232private static bool HasConflict(XElement source, XElement target) 250public static void RemoveAttributes(this XElement element, Func<XAttribute, bool> condition) 298foreach (var element in container.Elements())
NuGet.Packaging (128)
Core\NuspecCoreReader.cs (1)
40foreach (var node in nodes)
Core\NuspecCoreReaderBase.cs (5)
21private XElement? _metadataNode; 84var node = MetadataNode.Elements(XName.Get(Id, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 95var node = MetadataNode.Elements(XName.Get(Version, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 129var node = MetadataNode.Elements(XName.Get(DevelopmentDependency, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 181protected XElement MetadataNode
Core\NuspecUtility.cs (10)
50public static IReadOnlyList<PackageType> GetPackageTypes(XElement metadataNode, bool useMetadataNamespace) 52IEnumerable<XElement> nodes; 70foreach (var node in nodes) 114public static bool IsServiceable(XElement metadataNode) 117var element = metadataNode.Elements(XName.Get(Serviceable, metadataNamespace)).FirstOrDefault(); 142internal static IEnumerable<FrameworkReferenceGroup> GetFrameworkReferenceGroups(XElement metadataNode, IFrameworkNameProvider frameworkProvider, bool useMetadataNamespace) 145IEnumerable<XElement> frameworkReferenceGroups; 160foreach (var frameworkRefGroup in frameworkReferenceGroups) 175private static IEnumerable<string> GetFrameworkReferences(IEnumerable<XElement> nodes) 180private static string? GetAttributeValue(XElement element, string attributeName)
NuspecReader.cs (13)
130foreach (var depGroup in dependencyGroups) 172foreach (var group in MetadataNode.Elements(XName.Get(References, ns)).Elements(XName.Get(Group, ns))) 273var node = MetadataNode.Elements(XName.Get(Language, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 282var node = MetadataNode.Elements(XName.Get(LicenseUrl, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 293foreach (var filesNode in MetadataNode 414var node = MetadataNode.Elements(XName.Get(Repository, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 436var licenseNode = MetadataNode.Elements(XName.Get(NuspecUtility.License, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 582var node = MetadataNode.Elements(XName.Get(Icon, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 592var node = MetadataNode.Elements(XName.Get(Readme, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 596private bool? AttributeAsNullableBool(XElement element, string attributeName) 627private static string? GetAttributeValue(XElement element, string attributeName) 663private HashSet<PackageDependency> GetPackageDependencies(IEnumerable<XElement> nodes, bool useStrictVersionCheck) 667foreach (var depNode in nodes)
PackageCreation\Authoring\Manifest.cs (1)
135foreach (var e in document.Descendants())
PackageCreation\Authoring\ManifestReader.cs (15)
26var metadataElement = document.Root!.ElementsNoNamespace("metadata").FirstOrDefault(); 38private static ManifestMetadata ReadMetadata(XElement xElement) 46foreach (var element in xElement.Elements()) 70private static void ReadMetadataValue(ManifestMetadata manifestMetadata, XElement element, HashSet<string> allElements) 176private static IEnumerable<FrameworkReferenceGroup> ReadFrameworkReferenceGroups(XElement frameworkReferenceGroupsElement) 181private static LicenseMetadata ReadLicenseMetadata(XElement licenseNode) 244private static List<ManifestContentFiles> ReadContentFiles(XElement contentFilesElement) 270private static List<PackageReferenceSet> ReadReferenceSets(XElement referencesElement) 299public static List<string> ReadReference(XElement referenceElement, bool throwIfEmpty) 315private static List<FrameworkAssemblyReference> ReadFrameworkAssemblies(XElement frameworkElement) 332private static List<PackageDependencyGroup> ReadDependencyGroups(XElement dependenciesElement) 383private static ISet<PackageDependency> ReadDependencies(XElement containerElement) 401private static List<ManifestFile>? ReadFilesList(XElement? xElement) 409foreach (var file in xElement.ElementsNoNamespace("file")) 433private static RepositoryMetadata? ReadRepository(XElement element)
PackageCreation\Authoring\PackageBuilder.cs (1)
1217XElement element = new XElement(content + "Types",
PackageCreation\Extensions\XElementExtensions.cs (19)
14public static string? GetOptionalAttributeValue(this XElement element, string localName, string? namespaceName = null) 28public static IEnumerable<XElement> ElementsNoNamespace(this XContainer container, string localName) 33public static XElement Except(this XElement source, XElement? target) 62var sourceChild = sourceChildNode as XElement; 65var targetChild = FindElement(target, sourceChild); 83private static XElement? FindElement(XElement source, XElement targetChild) 94private static int Compare(XElement target, XElement left, XElement right) 112private static int CountMatches(XElement left, XElement right, Func<XAttribute, XAttribute, bool> matcher) 120private static bool HasComment(XElement element, XComment comment) 126private static bool HasConflict(XElement source, XElement target)
PackageCreation\Xml\PackageMetadataXmlExtensions.cs (24)
27public static XElement ToXElement(this ManifestMetadata metadata, XNamespace ns) 32public static XElement ToXElement(this ManifestMetadata metadata, XNamespace ns, bool generateBackwardsCompatible = true) 34var elem = new XElement(ns + "metadata"); 61var licenseElement = GetXElementFromLicenseMetadata(ns, metadata.LicenseMetadata); 95var repoElement = GetXElementFromManifestRepository(ns, metadata.Repository); 139private static XElement? GetXElementFromGroupableItemSets<TSet, TItem>( 145Func<XNamespace, TItem, XElement> getXElementFromItem, 169var childElements = new List<XElement>(); 180var groupElem = new XElement( 200private static XElement GetXElementFromFrameworkReference(XNamespace ns, FrameworkReference frameworkReference) 205private static XElement GetXElementFromPackageReference(XNamespace ns, string reference) 210private static XElement GetXElementFromPackageDependency(XNamespace ns, PackageDependency dependency) 234private static XElement? GetXElementFromFrameworkAssemblies(XNamespace ns, IEnumerable<FrameworkAssemblyReference> references) 251private static XElement? GetXElementFromManifestContentFiles(XNamespace ns, IEnumerable<ManifestContentFiles> contentFiles) 262private static XElement GetXElementFromManifestContentFile(XNamespace ns, ManifestContentFiles file) 276private static XElement GetXElementFromLicenseMetadata(XNamespace ns, LicenseMetadata metadata) 289private static XElement? GetXElementFromManifestRepository(XNamespace ns, RepositoryMetadata repository) 319private static XElement GetXElementFromManifestPackageTypes(XNamespace ns, IEnumerable<PackageType> packageTypes) 321var packageTypesElement = new XElement(ns + NuspecUtility.PackageTypes); 325var packageTypeElement = GetXElementFromManifestPackageType(ns, packageType); 332private static XElement GetXElementFromManifestPackageType(XNamespace ns, PackageType packageType) 355private static void AddElementIfNotNull<T>(XElement parent, XNamespace ns, string name, T? value) 364private static void AddElementIfNotNull<T>(XElement parent, XNamespace ns, string name, T? value, Func<T, object> process) 377private static void AddElementIfNotEmpty<T>(XElement parent, XNamespace ns, string name, IEnumerable<T> value, Func<IEnumerable<T>, object> process)
PackagesConfig.cs (5)
25public static bool TryGetAttribute(XElement node, string name, [NotNullWhen(returnValue: true)] out string? value) 43public static bool HasAttributeValue(XElement node, string attributeName, string targetValue, [NotNullWhen(returnValue: true)] out XElement? element) 45foreach (var package in node.Elements(XName.Get(PackageNodeName))) 62public static bool BoolAttribute(XElement node, string name, bool defaultValue = false)
PackagesConfigReader.cs (1)
143foreach (var package in _doc.Root!.Elements(XName.Get(PackagesConfig.PackageNodeName)))
PackagesConfigWriter.cs (26)
128var packagesNode = EnsurePackagesNode(); 190var packagesNode = EnsurePackagesNode(); 192XElement? package; 201var node = CreateXElementForPackageEntry(entry); 230var packagesNode = EnsurePackagesNode(); 233var matchingNode = FindMatchingPackageNode(oldEntry, packagesNode); 242var newPackageNode = ReplacePackageAttributes(matchingNode, newEntry); 268var originalPackagesNode = originalConfig.Element(XName.Get(PackagesConfig.PackagesNodeName)); 270XElement? matchingIdNode; 279var packagesNode = _xDocument.Element(XName.Get(PackagesConfig.PackagesNodeName)); 280var newPackageNode = ReplacePackageAttributes(matchingIdNode!, newEntry); 346var packagesNode = EnsurePackagesNode(); 348var matchingNode = FindMatchingPackageNode(entry, packagesNode); 361private XElement CreateXElementForPackageEntry(PackageReference entry) 363var node = new XElement(XName.Get(PackagesConfig.PackageNodeName)); 402var packagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName)); 408private XElement EnsurePackagesNode() 410var packagesNode = _xDocument.Element(XName.Get(PackagesConfig.PackagesNodeName)); 421private XElement? FindMatchingPackageNode(PackageReference entry, XElement packagesNode) 423XElement? matchingIdNode; 447private XElement ReplacePackageAttributes(XElement existingNode, PackageReference newEntry) 449var newEntryNode = CreateXElementForPackageEntry(newEntry); 493private void SortPackageNodes(XElement packagesNode) 495var newPackagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName),
Rules\InvalidUndottedFrameworkRule.cs (7)
53var metadataNode = xml.Root!.Elements().FirstOrDefault(e => StringComparer.Ordinal.Equals(e.Name.LocalName, Metadata)); 80internal static IEnumerable<PackagingLogMessage> ValidateDependencyGroups(XElement metadataNode) 90foreach (var depGroup in dependencyGroups) 114internal static IEnumerable<PackagingLogMessage> ValidateReferenceGroups(XElement metadataNode) 119foreach (var group in metadataNode.Elements(XName.Get(References, ns)).Elements(XName.Get(Group, ns))) 143internal static IEnumerable<PackagingLogMessage> ValidateFrameworkAssemblies(XDocument xml, XElement metadataNode) 279private static string? GetAttributeValue(XElement element, string attributeName)
NuGet.Protocol (13)
LegacyFeed\LegacyFeedCapabilityResourceV2Feed.cs (2)
139var packageEntityContainer = result.Container; 173var packageEntity = (from e in schemaDocument.Descendants()
LegacyFeed\V2FeedParser.cs (8)
330private V2FeedPackageInfo ParsePackage(string id, XElement element, MetadataReferenceCache metadataCache) 332var properties = element.Element(_xnameProperties); 333var idElement = properties.Element(_xnameId); 334var titleElement = element.Element(_xnameTitle); 379var authorNode = element.Element(_xnameAuthor); 394private static string GetString(XElement parent, XName childName) 400var child = parent.Element(childName); 414private static DateTimeOffset? GetDate(XElement parent, XName childName)
RemoteRepositories\RemoteV2FindPackageByIdResource.cs (3)
568private static PackageInfo BuildModel(string id, XElement element) 570var properties = element.Element(_xnameProperties); 571var idElement = properties.Element(_xnameId);
PresentationFramework-SystemXmlLinq (3)
SystemXmlLinqExtension.cs (3)
20XElement xelement = new XElement("Dummy"); 32return item is XElement; 38XName name = ((XElement)item).Name;
Roslyn.Diagnostics.Analyzers (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
sdk-tasks (3)
GetDependencyInfo.cs (1)
31XElement dependency = document
OverrideAndCreateBundledNETCoreAppPackageVersion.cs (2)
57foreach (var item2 in items2Filtered) 72var item0 = matches0[0];
Shared.Tests (1)
JsonSchemaExporter\TestTypes.cs (1)
1313[JsonSerializable(typeof(XElement))]
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.CoreLib.Generators (19)
NativeRuntimeEventSourceGenerator.cs (19)
46XElement? providerNode = manifest 132private static string GenerateEventSourceClass(XElement providerNode, string className, Dictionary<string, HashSet<string>> inclusionList) 159private static void GenerateKeywordsClass(XElement providerNode, StringWriter writer, Dictionary<string, HashSet<string>> inclusionList) 168XElement eventsNode = providerNode.Element(EventNs + "events"); 174IEnumerable<XElement> eventNodes = eventsNode.Elements(EventNs + "event"); 176foreach (XElement? eventNode in eventNodes) 195XElement? keywordsNode = providerNode.Element(EventNs + "keywords"); 206foreach (XElement keywordNode in keywordsNode.Elements(EventNs + "keyword")) 222private static void GenerateEventMethods(XElement providerNode, StringWriter writer, Dictionary<string, HashSet<string>> inclusionList) 231XElement eventsNode = providerNode.Element(EventNs + "events"); 238XElement templatesNode = providerNode.Element(EventNs + "templates"); 239var templateDict = new Dictionary<string, XElement>(); 242foreach (XElement? template in templatesNode.Elements(EventNs + "template")) 254foreach (XElement? eventNode in eventNodes) 274foreach (XElement? eventNode in eventNodes) 319&& templateDict.TryGetValue(templateValue, out XElement? template)) 321IEnumerable<XElement> dataNodes = template.Elements(EventNs + "data").ToArray(); 328foreach (XElement data in dataNodes) 345foreach (XElement data in dataNodes)
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
371if (type == typeof(System.Xml.Linq.XElement))
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\XAttribute.cs (8)
114get { return parent != null && ((XElement)parent).lastAttr != this ? next : null; } 143XAttribute a = ((XElement)parent).lastAttr!; 148return a != ((XElement)parent).lastAttr ? a : null; 183((XElement)parent).RemoveAttribute(this); 188/// <seealso cref="XElement.SetValue"/> 189/// <seealso cref="XElement.SetAttributeValue"/> 190/// <seealso cref="XElement.SetElementValue"/> 694if (parent != null) return ((XElement)parent).GetPrefixOfNamespace(ns);
System\Xml\Linq\XContainer.cs (46)
20/// <see cref="XDocument"/> and <see cref="XElement"/>. 239/// applies only for <see cref="XElement"/>. 259/// Returns the descendant <see cref="XElement"/>s of this <see cref="XContainer"/>. Note this method will 260/// not return itself in the resulting IEnumerable. See <see cref="XElement.DescendantsAndSelf()"/> if you 261/// need to include the current <see cref="XElement"/> in the results. 262/// <seealso cref="XElement.DescendantsAndSelf()"/> 265/// An IEnumerable of <see cref="XElement"/> with all of the descendants below this <see cref="XContainer"/> in the XML tree. 267public IEnumerable<XElement> Descendants() 273/// Returns the Descendant <see cref="XElement"/>s with the passed in <see cref="XName"/> as an IEnumerable 276/// <param name="name">The <see cref="XName"/> to match against descendant <see cref="XElement"/>s.</param> 277/// <returns>An <see cref="IEnumerable"/> of <see cref="XElement"/></returns> 278public IEnumerable<XElement> Descendants(XName? name) 280return name != null ? GetDescendants(name, false) : XElement.EmptySequence; 292/// An <see cref="XElement"/> child that matches the <see cref="XName"/> passed in, or null. 294public XElement? Element(XName name) 302XElement? e = n as XElement; 310/// Returns the child <see cref="XElement"/>s of this <see cref="XContainer"/>. 316/// An <see cref="IEnumerable"/> over all of this <see cref="XContainer"/>'s child <see cref="XElement"/>s. 318public IEnumerable<XElement> Elements() 327/// The <see cref="XName"/> to match against the <see cref="XElement"/> children of this <see cref="XContainer"/>. 330/// An <see cref="IEnumerable"/> of <see cref="XElement"/> children of this <see cref="XContainer"/> that have 333public IEnumerable<XElement> Elements(XName? name) 335return name != null ? GetElements(name) : XElement.EmptySequence; 341/// <seealso cref="XElement.Attributes()"/> 346/// <seealso cref="XElement.Attributes()"/> 364/// methods does not remove attributes. See <see cref="XElement.RemoveAttributes()"/>. 365/// <seealso cref="XElement.RemoveAttributes()"/> 385if (this is XElement) 554if (this is XElement) 766internal IEnumerable<XElement> GetDescendants(XName? name, bool self) 770XElement e = (XElement)this; 787XElement? e = n as XElement; 793private IEnumerable<XElement> GetElements(XName? name) 801XElement? e = n as XElement; 906XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 960XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1020XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1058XElement? e = _currentContainer as XElement; 1134XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1174XElement? e = _currentContainer as XElement;
System\Xml\Linq\XDocument.cs (2)
149public XElement? Root 153return GetFirstNode<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\XLinq.cs (14)
45if (_parent is XElement) 206public void WriteElement(XElement e) 209XElement root = e; 213XElement? current = n as XElement; 250public async Task WriteElementAsync(XElement e, CancellationToken cancellationToken) 253XElement root = e; 257XElement? current = n as XElement; 306private void PushAncestors(XElement? e) 310e = e!.parent as XElement; 327private void PushElement(XElement e) 370private void WriteStartElement(XElement e) 389private async Task WriteStartElementAsync(XElement e, CancellationToken cancellationToken)
System\Xml\Linq\XNode.cs (22)
21/// <see cref="XElement"/>, 188public IEnumerable<XElement> Ancestors() 205public IEnumerable<XElement> Ancestors(XName? name) 207return name != null ? GetAncestors(name, false) : XElement.EmptySequence; 345public IEnumerable<XElement> ElementsAfterSelf() 359public IEnumerable<XElement> ElementsAfterSelf(XName? name) 361return name != null ? GetElementsAfterSelf(name) : XElement.EmptySequence; 371public IEnumerable<XElement> ElementsBeforeSelf() 385public IEnumerable<XElement> ElementsBeforeSelf(XName? name) 387return name != null ? GetElementsBeforeSelf(name) : XElement.EmptySequence; 498return await XElement.CreateAsync(reader, cancellationToken).ConfigureAwait(false); 591/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 627internal IEnumerable<XElement> GetAncestors(XName? name, bool self) 629XElement? e = (self ? this : parent) as XElement; 633e = e.parent as XElement; 637private IEnumerable<XElement> GetElementsAfterSelf(XName? name) 643XElement? e = n as XElement; 648private IEnumerable<XElement> GetElementsBeforeSelf(XName? name) 657XElement? e = n as XElement;
System\Xml\Linq\XNodeBuilder.cs (3)
110_parent = ((XElement)_parent!).parent; 139XElement e = (XElement)_parent!;
System\Xml\Linq\XNodeEqualityComparer.cs (2)
28/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 67/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same
System\Xml\Linq\XNodeReader.cs (64)
45XElement? e = GetElementInAttributeScope(); 133XElement? e = GetElementInAttributeScope(); 188XElement? e = _source as XElement; 204XElement? e = _source as XElement; 251XElement? e = _source as XElement; 319XElement? e = _source as XElement; 396XElement? e = GetElementInScope(); 407e = e.parent as XElement; 422XElement? e = GetElementInScope(); 441e = e.parent as XElement; 470XElement? e = GetElementInAttributeScope(); 516XElement? e = GetElementInAttributeScope(); 562XElement? e = GetElementInAttributeScope(); 594XElement? e = GetElementInScope(); 612XElement? e = GetElementInAttributeScope(); 650XElement? e = GetElementInAttributeScope(); 698XElement? e = GetElementInAttributeScope(); 752XElement? e = GetElementInAttributeScope(); 782XElement? e = _source as XElement; 818if (a.parent != null && ((XElement)a.parent).lastAttr != a) 883XElement? c = _source as XElement; 890foreach (XElement e in c.Descendants()) 908XElement? e = _source as XElement; 933foreach (XElement e in n.ElementsAfterSelf()) 943if (n.parent is XElement) 952if (_parent is XElement) 983XElement? e = _source as XElement; 1008XElement? e = _source as XElement; 1038XElement? e = _source as XElement; 1080private XElement? GetElementInAttributeScope() 1082XElement? e = _source as XElement; 1094return (XElement?)a.parent; 1099return (XElement?)a.parent; 1104private XElement? GetElementInScope() 1106XElement? e = _source as XElement; 1114return n.parent as XElement; 1119return (XElement?)a.parent; 1121e = _parent as XElement; 1129return (XElement?)a.parent; 1134private static void GetNameInAttributeScope(string? qualifiedName, XElement e, out string? localName, out string? namespaceName) 1162XElement? e = _source as XElement; 1205private bool ReadIntoElement(XElement e) 1240XElement? e = (XElement?)a.parent; 1278if (_parent is XElement) 1333XElement? element = candidateAttribute.parent as XElement; 1339element = element.parent as XElement; 1374element = element.parent as XElement; 1392XElement? e = candidate.parent as XElement;
System\Xml\Linq\XObject.cs (4)
66/// Gets the parent <see cref="XElement"/> of this <see cref="XObject"/>. 69/// If this <see cref="XObject"/> has no parent <see cref="XElement"/>, this property returns null. 71public XElement? Parent 73get { return parent as XElement; }
System\Xml\Schema\XNodeValidator.cs (16)
83ValidateElement((XElement)source); 171private void PushAncestorsAndSelf(XElement? e) 195e = e.parent as XElement; 199private void PushElement(XElement e, ref string? xsiType, ref string? xsiNil) 259private void ValidateAttributes(XElement e) 296private void ValidateElement(XElement e) 322private void ValidateNodes(XElement e) 331XElement? c = n as XElement; 435/// Gets the schema information that has been assigned to the <see cref="XElement"/> as a result of schema validation. 438public static IXmlSchemaInfo? GetSchemaInfo(this XElement source) 489/// Validate a <see cref="XElement"/> 499public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler) 505/// Validate a <see cref="XElement"/> 515/// <param name="addSchemaInfo">If enabled the <see cref="XElement"/> and the corresponding 518public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler, bool addSchemaInfo)
System\Xml\XPath\XNodeNavigator.cs (46)
47private XElement? _parent; 84XElement? element = _source as XElement; 122XElement? e = _source as XElement; 134XElement? e = _source as XElement; 176XElement? e = _source as XElement; 232XElement? e = _source as XElement; 275return ((XElement)_source).Value; 279XElement? root = ((XDocument)_source).Root; 325XElement? e = _source as XElement; 347foreach (XElement element in c.Elements()) 384XElement? e = _source as XElement; 418XElement? e = _source as XElement; 456XElement? e = _source as XElement; 523foreach (XElement element in currentNode.ElementsAfterSelf()) 573XElement? e = (XElement?)currentAttribute.GetParent(); 750if (c.GetParent() != null || c is XElement) 772private static XAttribute? GetFirstNamespaceDeclarationGlobal(XElement e) 774XElement? ce = e; 787private static XAttribute? GetFirstNamespaceDeclarationLocal(XElement e) 801XElement? e = (XElement?)a.GetParent(); 821XElement? e = a.Parent; 848private static bool HasNamespaceDeclarationInScope(XAttribute a, XElement e) 851XElement? ce = e; 966/// Select an <see cref="XElement"/> using a XPath expression 970/// <returns>An <see cref="XElement"> or null</see></returns> 971public static XElement? XPathSelectElement(this XNode node, string expression) 977/// Select an <see cref="XElement"/> using a XPath expression 983/// <returns>An <see cref="XElement"> or null</see></returns> 984public static XElement? XPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver? resolver) 990/// Select a set of <see cref="XElement"/> using a XPath expression 995public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression) 1001/// Select a set of <see cref="XElement"/> using a XPath expression 1008public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression, IXmlNamespaceResolver? resolver) 1012return (IEnumerable<XElement>)XPathEvaluator.Evaluate<XElement>(node, expression, resolver);
System.Xml.Linq (1)
System.Xml.Linq.cs (1)
15[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
System.Xml.XDocument (1)
src\runtime\artifacts\obj\System.Xml.XDocument\Release\net11.0\System.Xml.XDocument.Forwards.cs (1)
14[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]