4
* RSS.NET (http://rss-net.sf.net/)
5
* Copyright � 2002 - 2005 George Tsiokos. All Rights Reserved.
7
* RSS 2.0 (http://blogs.law.harvard.edu/tech/rss)
8
* RSS 2.0 is offered by the Berkman Center for Internet & Society at
9
* Harvard Law School under the terms of the Attribution/Share Alike
10
* Creative Commons license.
12
* Permission is hereby granted, free of charge, to any person obtaining
13
* a copy of this software and associated documentation files (the "Software"),
14
* to deal in the Software without restriction, including without limitation
15
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
* and/or sell copies of the Software, and to permit persons to whom the
17
* Software is furnished to do so, subject to the following conditions:
19
* The above copyright notice and this permission notice shall be included in all
20
* copies or substantial portions of the Software.
22
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
using System.Collections.Generic;
35
/// <summary>A module may contain any number of items (either channel-based or item-based).</summary>
37
public class RssModuleItem : RssElement
39
private bool _bRequired = false;
40
private string _sElementName = RssDefault.String;
41
private string _sElementText = RssDefault.String;
42
private List<RssModuleItem> _rssSubElements = new List<RssModuleItem>();
44
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
45
public RssModuleItem()
49
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
50
/// <param name="name">The name of this RssModuleItem.</param>
51
public RssModuleItem(string name)
53
this._sElementName = RssDefault.Check(name);
56
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
57
/// <param name="name">The name of this RssModuleItem.</param>
58
/// <param name="required">Is text required for this RssModuleItem?</param>
59
public RssModuleItem(string name, bool required) : this(name)
61
this._bRequired = required;
64
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
65
/// <param name="name">The name of this RssModuleItem.</param>
66
/// <param name="text">The text contained within this RssModuleItem.</param>
67
public RssModuleItem(string name, string text) : this(name)
69
this._sElementText = RssDefault.Check(text);
72
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
73
/// <param name="name">The name of this RssModuleItem.</param>
74
/// <param name="required">Is text required for this RssModuleItem?</param>
75
/// <param name="text">The text contained within this RssModuleItem.</param>
76
public RssModuleItem(string name, bool required, string text) : this(name, required)
78
this._sElementText = RssDefault.Check(text);
81
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
82
/// <param name="name">The name of this RssModuleItem.</param>
83
/// <param name="text">The text contained within this RssModuleItem.</param>
84
/// <param name="subElements">The sub-elements of this RssModuleItem (if any exist).</param>
85
public RssModuleItem(string name, string text, List<RssModuleItem> subElements) : this(name, text)
87
this._rssSubElements = subElements;
90
/// <summary>Initialize a new instance of the RssModuleItem class</summary>
91
/// <param name="name">The name of this RssModuleItem.</param>
92
/// <param name="required">Is text required for this RssModuleItem?</param>
93
/// <param name="text">The text contained within this RssModuleItem.</param>
94
/// <param name="subElements">The sub-elements of this RssModuleItem (if any exist).</param>
95
public RssModuleItem(string name, bool required, string text, List<RssModuleItem> subElements) : this(name, required, text)
97
this._rssSubElements = subElements;
100
/// <summary>Returns a string representation of the current Object.</summary>
101
/// <returns>The item's title, description, or "RssModuleItem" if the title and description are blank.</returns>
102
public override string ToString()
104
if (Name != RssDefault.String)
106
else if (Text != RssDefault.String)
109
return "RssModuleItem";
113
/// The name of this RssModuleItem.
117
get { return this._sElementName; }
118
set { this._sElementName = RssDefault.Check(value); }
122
/// The text contained within this RssModuleItem.
126
get { return this._sElementText; }
127
set { this._sElementText = RssDefault.Check(value); }
131
/// The sub-elements of this RssModuleItem (if any exist).
133
public List<RssModuleItem> SubElements
135
get { return this._rssSubElements; }
136
set { this._rssSubElements = value;}
140
/// Is text for this element required?
142
public bool IsRequired
144
get { return this._bRequired; }