Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
01401f0
Add support for repeated XML elements without a name attribute
amoerie Nov 12, 2020
f83dcfe
Disable tests for duplicate handling in XML config, they are incompat…
amoerie Nov 13, 2020
8de7bda
Stop using the 'Name' parameter to use arrays in XML in the tests, th…
amoerie Nov 13, 2020
96ea0b9
Merge branch 'master' of github.com:dotnet/runtime into repeatedeleme…
amoerie Dec 17, 2020
ca7097a
Rework the XML configuration provider
amoerie Dec 18, 2020
c601197
Add test that verifies mixing repeated with non-repeated XML elements…
amoerie Dec 18, 2020
3dddfca
Cleanup nullable annotations in XmlConfigurationElement
amoerie Feb 5, 2021
5b55a5f
Use ordinal ignore case when detecting siblings in XML configuration
amoerie Feb 5, 2021
cd11a03
Remove empty line
amoerie Feb 5, 2021
ff2336f
Remove usage of Linq method '.Any()'
amoerie Feb 5, 2021
de44ff0
Remove dependency on System.Linq in XmlStreamConfigurationProvider
amoerie Feb 5, 2021
2f77e01
Simplify check that detects whether the current element is the root e…
amoerie Feb 5, 2021
5999c1c
Merge branch 'master' of github.com:dotnet/runtime into repeatedeleme…
amoerie Feb 5, 2021
9a1af2a
Apply suggestions from code review
amoerie Feb 8, 2021
6f07563
Add test for array simulation using Name attribute
amoerie Feb 8, 2021
e479aa9
Add tests related to case insensitivity in XML configuration keys
amoerie Feb 8, 2021
f2e56ee
Merge master and resolve conflicts
amoerie Feb 8, 2021
8901143
Improve performance of XML configuration provider
amoerie Feb 28, 2021
862244e
Revert accidental change of solution file
amoerie Mar 1, 2021
49024de
Merge branch 'main' into repeatedelementsinxmlconfig
amoerie Mar 1, 2021
2c2f1b3
Apply suggestion from feedback: simplify children list initialization
amoerie Mar 10, 2021
22c02e8
Rename ProcessAttributes -> ReadAttributes when parsing the XML
amoerie Mar 10, 2021
5a60973
Merge branch 'main' of github.com:dotnet/runtime into repeatedelement…
amoerie Mar 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;

namespace Microsoft.Extensions.Configuration.Xml
{
internal class XmlConfigurationElement
{
public string ElementName { get; }

public string Name { get; }

public string LineInfo { get; }

/// <summary>
/// The children of this element
/// </summary>
public List<XmlConfigurationElement>? Children { get; set; }

/// <summary>
/// The siblings of this element, including itself
/// Elements are considered siblings if they share the same element name and name attribute
/// This list is shared by each sibling
/// </summary>
public List<XmlConfigurationElement>? Siblings { get; set; }

public XmlConfigurationElementTextContent? TextContent { get; set; }

public List<XmlConfigurationElementAttributeValue>? Attributes { get; set; }

public XmlConfigurationElement(string elementName, string name, string lineInfo)
{
ElementName = elementName ?? throw new ArgumentNullException(nameof(elementName));
Name = name;
LineInfo = lineInfo;
Children = null;
Siblings = null;
TextContent = null;
Attributes = null;
}

public bool IsSiblingOf(XmlConfigurationElement xmlConfigurationElement)
{
if (xmlConfigurationElement is null)
{
throw new ArgumentNullException(nameof(xmlConfigurationElement));
}

return string.Equals(ElementName, xmlConfigurationElement.ElementName)
&& string.Equals(Name, xmlConfigurationElement.Name);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;

namespace Microsoft.Extensions.Configuration.Xml
{
internal class XmlConfigurationElementAttributeValue
{
public XmlConfigurationElementAttributeValue(string attribute, string value, string lineInfo)
{
Attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
Value = value ?? throw new ArgumentNullException(nameof(value));
LineInfo = lineInfo;
}

public string Attribute { get; }

public string Value { get; }

public string LineInfo { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;

namespace Microsoft.Extensions.Configuration.Xml
{
internal class XmlConfigurationElementTextContent
{
public XmlConfigurationElementTextContent(string textContent, string lineInfo)
{
TextContent = textContent ?? throw new ArgumentNullException(nameof(textContent));
LineInfo = lineInfo ?? throw new ArgumentNullException(nameof(lineInfo));
}

public string TextContent { get; }

public string LineInfo { get; }
}
}
Loading