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.Xml;
3
using
Waher.Content.Xml
;
4
using
Waher.Runtime.Collections
;
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
ChunkedList<RssWarning>
Warnings
=
new
ChunkedList<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(this.
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:21
Waher.Content.Xml.XML.Attribute
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition:
XML.cs:1062
Waher.Runtime.Collections.ChunkedList
A chunked list is a linked list of chunks of objects of type T .
Definition:
ChunkedList.cs:54
Waher.Runtime.Collections.ChunkedList.Add
void Add(T Item)
Adds an item to the collection.
Definition:
ChunkedList.cs:272
System
Definition:
Adapters.g.cs:58
Waher.Content.Rss
Definition:
IRssExtension.cs:6
Waher.Content.Xml
Definition:
Attribute.cs:7
Waher.Runtime.Collections
Definition:
ChunkedList.cs:9
IoTGateway
Content
Waher.Content.Rss
RssEnclosure.cs
Generated by
1.9.5