Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
RssEnclosure.cs
1
using
System;
2
using
System.Collections.Generic;
3
using
System.Xml;
4
using
Waher.Content.Xml
;
5
6
namespace
Waher.Content.Rss
7
{
11
public
class
RssEnclosure
12
{
18
public
RssEnclosure
(XmlElement Xml, Uri BaseUri)
19
{
20
if
(Xml is
null
)
21
throw
new
ArgumentNullException(nameof(Xml));
22
23
List<RssWarning>
Warnings
=
new
List<RssWarning>();
24
25
string
s =
XML
.
Attribute
(Xml,
"url"
);
26
if
(Uri.TryCreate(BaseUri, s, out Uri
Url
))
27
this.Url =
Url
;
28
else
29
Warnings
.Add(
new
RssWarning
(Xml,
"Invalid URL: "
+ Xml.OuterXml));
30
31
this.Length =
XML
.
Attribute
(Xml,
"length"
, 0L);
32
if
(this.
Length
<= 0)
33
Warnings.Add(
new
RssWarning
(Xml,
"Invalid Length: "
+ Xml.OuterXml));
34
35
this.ContentType =
XML
.
Attribute
(Xml,
"type"
);
36
if
(
string
.IsNullOrEmpty(
ContentType
))
37
Warnings
.Add(
new
RssWarning
(Xml,
"Invalid Content-Type: "
+ Xml.OuterXml));
38
39
this.Warnings =
Warnings
.ToArray();
40
}
41
45
public
RssWarning
[]
Warnings
{
get
; }
46
50
public
Uri
Url
{
get
; } =
null
;
51
55
public
long
Length
{
get
; }
56
60
public
string
ContentType
{
get
; }
61
}
62
}
Waher.Content.Rss.RssEnclosure
Describes content enclosed in an RSS item.
Definition:
RssEnclosure.cs:12
Waher.Content.Rss.RssEnclosure.Warnings
RssWarning[] Warnings
Any warning messages created during parsing.
Definition:
RssEnclosure.cs:45
Waher.Content.Rss.RssEnclosure.ContentType
string ContentType
Content-Type of content
Definition:
RssEnclosure.cs:60
Waher.Content.Rss.RssEnclosure.RssEnclosure
RssEnclosure(XmlElement Xml, Uri BaseUri)
Describes content enclosed in an RSS item.
Definition:
RssEnclosure.cs:18
Waher.Content.Rss.RssEnclosure.Url
Uri Url
URL to the content.
Definition:
RssEnclosure.cs:50
Waher.Content.Rss.RssEnclosure.Length
long Length
Length of content.
Definition:
RssEnclosure.cs:55
Waher.Content.Rss.RssWarning
Contains a warning message.
Definition:
RssWarning.cs:9
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.Attribute
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition:
XML.cs:914
Waher.Content.Rss
Definition:
IRssExtension.cs:6
Waher.Content.Xml
Definition:
XmlCodec.cs:11
IoTGateway
Content
Waher.Content.Rss
RssEnclosure.cs
Generated by
1.9.5