| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.Text; |
| 4 |
|
| 5 |
namespace xmlTools |
| 6 |
{ |
| 7 |
/// <summary> |
| 8 |
/// This class represents a xmlTextValue. It supports various dimensions separated by spaces. For example a vehicle array: "car motorcycle bicycle" |
| 9 |
/// It also includes various functions to work with multi dimensional xml string values |
| 10 |
/// </summary> |
| 11 |
class XmlTextValue |
| 12 |
{ |
| 13 |
public List<String> myValues = new List<String>(); //include all dimensions of the value |
| 14 |
|
| 15 |
public XmlTextValue(String myString) |
| 16 |
{ |
| 17 |
String[] values = myString.Split(' '); |
| 18 |
|
| 19 |
foreach (string value in values) |
| 20 |
{ |
| 21 |
this.myValues.Add(value); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
public XmlTextValue(List<String> myDimensions) |
| 26 |
{ |
| 27 |
this.myValues = myDimensions; |
| 28 |
} |
| 29 |
|
| 30 |
public override string ToString() |
| 31 |
{ |
| 32 |
String result = ""; |
| 33 |
|
| 34 |
for (int i = 0; i < this.myValues.Count - 1; i++) |
| 35 |
{ |
| 36 |
result += this.myValues[i] + " "; |
| 37 |
} |
| 38 |
result += this.myValues[this.myValues.Count - 1]; |
| 39 |
|
| 40 |
return result; |
| 41 |
} |
| 42 |
} |
| 43 |
} |