1
public class XmlResourceReader
2
{
3
private string _fileName = "";
4
5
private System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
6
public XmlResourceReader(string fileName)
7
{
8
this._fileName = fileName;
9
Initial();
10
}
11
12
public string fileName
13
{
14
get
15
{
16
return this._fileName;
17
}
18
}
19
20
private void Initial()
21
{
22
if (System.IO.File.Exists(this.fileName))
23
{
24
xDoc.Load(this.fileName);
25
}
26
}
27
28
public string GetString(string ID)
29
{
30
ID = ID.Replace("'", "'");
31
string xPath = @"//Localizations/Loc[@_locID='" + ID + "']";
32
System.Xml.XmlNode node = xDoc.SelectSingleNode(xPath);
33
if (node != null)
34
{
35
return node.InnerText;
36
}
37
else
38
{
39
return null;
40
}
41
}
42
43
}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

Xml resource file:









