45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Xml.Linq;
|
|
using CRIF.ACTion.Configuration;
|
|
|
|
namespace CRIF.ACTion.Common.Builders
|
|
{
|
|
public class CrifRequestSection : IBuildable
|
|
{
|
|
private readonly XNamespace SectionNamespace;
|
|
private readonly string SectionName;
|
|
private readonly List<XObject> Content;
|
|
private readonly List<XObject> Attributes;
|
|
|
|
private protected readonly CrifSettings _settings;
|
|
|
|
private protected CrifRequestSection(XNamespace sectionNamespace, string sectionName, CrifSettings settings)
|
|
{
|
|
SectionNamespace = sectionNamespace;
|
|
SectionName = sectionName;
|
|
|
|
Content = [];
|
|
Attributes = [];
|
|
|
|
_settings = settings;
|
|
}
|
|
|
|
public XElement Build(params XElement[] content)
|
|
{
|
|
var element = new XElement(SectionNamespace + SectionName, Attributes);
|
|
element.Add([.. Content]);
|
|
|
|
return element;
|
|
}
|
|
|
|
public void AddContent(XObject element)
|
|
{
|
|
Content.Add(element);
|
|
}
|
|
|
|
public void AddAttribute(XObject attribute)
|
|
{
|
|
Attributes.Add(attribute);
|
|
}
|
|
}
|
|
}
|