|
1
|
|
#region Copyright
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
13
|
|
|
|
14
|
|
|
|
15
|
|
|
|
16
|
|
|
|
17
|
|
|
|
18
|
|
|
|
19
|
|
|
|
20
|
|
|
|
21
|
|
|
|
22
|
|
#endregion
|
|
23
|
|
|
|
24
|
|
using System.Collections;
|
|
25
|
|
using System.Xml;
|
|
26
|
|
using log4net;
|
|
27
|
|
|
|
28
|
|
namespace ShowX.Model.XmlModel
|
|
29
|
|
{
|
|
30
|
|
|
|
31
|
|
|
|
32
|
|
|
|
33
|
|
public class XmlView : IView
|
|
34
|
|
{
|
|
35
|
|
private static readonly ILog log = LogManager.GetLogger(
|
|
36
|
|
typeof(XmlView));
|
|
37
|
|
|
|
38
|
|
string name;
|
|
39
|
|
ArrayList properties;
|
|
40
|
|
|
|
41
|
|
|
|
42
|
|
|
|
43
|
|
|
|
44
|
|
|
|
45
|
20
|
public XmlView (XmlNode viewNode)
|
|
46
|
|
{
|
|
47
|
20
|
this.name = viewNode
|
|
48
|
|
.Attributes[XmlMappingFileConst.singleViewTagViewNameAttr].Value;
|
|
49
|
|
|
|
50
|
20
|
if (name == "") {
|
|
51
|
|
|
|
52
|
0
|
log.Fatal("Name of view required.");
|
|
53
|
0
|
throw new ModelException("Name of view required.");
|
|
54
|
|
}
|
|
55
|
|
|
|
56
|
20
|
properties = new ArrayList();
|
|
57
|
|
|
|
58
|
20
|
foreach (XmlNode node in viewNode.SelectSingleNode(XmlMappingFileConst
|
|
59
|
|
.propertySetTag).ChildNodes) {
|
|
60
|
|
|
|
61
|
50
|
string propertyName = node.Attributes[XmlMappingFileConst
|
|
62
|
|
.propertySetPropertyTagNameAttr].Value;
|
|
63
|
|
|
|
64
|
50
|
if (propertyName == "") {
|
|
65
|
|
|
|
66
|
0
|
log.Fatal("Property name cannot be empty.");
|
|
67
|
0
|
throw new ModelException("Property name cannot be empty.");
|
|
68
|
|
}
|
|
69
|
|
|
|
70
|
50
|
properties.Add(propertyName);
|
|
71
|
|
}
|
|
72
|
|
}
|
|
73
|
|
|
|
74
|
|
#region IView Members
|
|
75
|
|
|
|
76
|
|
|
|
77
|
|
|
|
78
|
|
|
|
79
|
0
|
public ArrayList Properties
|
|
80
|
|
{
|
|
81
|
|
get
|
|
82
|
|
{
|
|
83
|
|
return this.properties;
|
|
84
|
|
}
|
|
85
|
|
}
|
|
86
|
|
|
|
87
|
|
|
|
88
|
|
|
|
89
|
|
|
|
90
|
|
public string Name
|
|
91
|
|
{
|
|
92
|
20
|
get
|
|
93
|
|
{
|
|
94
|
20
|
return this.name;
|
|
95
|
|
}
|
|
96
|
|
}
|
|
97
|
|
|
|
98
|
|
#endregion
|
|
99
|
|
}
|
|
100
|
|
}
|