Skip to content

Commit

Permalink
Add extra properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan130200 committed Jan 26, 2025
1 parent 4371cca commit 4739747
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions MiniXmpp/Dom/XmppElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class XmppElement : XmppNode

public XmppName TagName { get; set; } = default!;

public string QualifiedName
=> TagName.ToString();

public string LocalName
{
get => TagName.LocalName;
Expand Down Expand Up @@ -65,7 +68,8 @@ public override string? Value
{
get
{
return string.Concat(from n in Nodes().OfType<XmppText>()
return string.Concat(from n in Nodes()
.OfType<XmppText>()
select n.Value);
}
set
Expand Down Expand Up @@ -211,8 +215,23 @@ public IEnumerable<XmppNode> Nodes()
}
}

public XmppElement? Element(XmppName name) => Elements().FirstOrDefault(e => e.TagName == name);
public IEnumerable<XmppElement> Elements() => Nodes().OfType<XmppElement>();
public XmppNode? FirstNode
=> Nodes().FirstOrDefault();

public XmppNode? LastNode
=> Nodes().LastOrDefault();

public XmppElement? FirstChild
=> Elements().FirstOrDefault();

public XmppElement? LastChild
=> Elements().LastOrDefault();

public XmppElement? Element(XmppName name)
=> Elements().FirstOrDefault(e => e.TagName == name);

public IEnumerable<XmppElement> Elements()
=> Nodes().OfType<XmppElement>();

public virtual void RemoveAll()
{
Expand Down
2 changes: 1 addition & 1 deletion MiniXmpp/MiniXmpp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<RepositoryUrl>https://github.com/nathan130200/MiniXMPP</RepositoryUrl>
<PackageTags>xmpp, xmpp client, xmpp server, xmpp component, xmpp parser</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand Down

0 comments on commit 4739747

Please sign in to comment.