XmlData GetAttributeValue Method (String)Delta Engine Documentation

Namespace: DeltaEngine.Content.Xml
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public string GetAttributeValue(
	string attributeName
)

Return Value

Type: String
Remarks

Tests: DeltaEngine.Content.Xml.Tests.XmlDataTests
Examples

5 unit tests call DeltaEngine.Content.Xml.XmlData.GetAttributeValue(System.String)
[Test]
public void GetAttributeValue()
{
    var root = new XmlData("root");
    root.AddAttribute("attribute", "value");
    Assert.AreEqual("value", root.GetAttributeValue("attribute"));
    Assert.AreEqual("", root.GetAttributeValue("attribute2"));
}
[Test]
public void GetAttributeValueAsInteger()
{
    var root = new XmlData("root");
    root.AddAttribute("number", "123");
    Assert.AreEqual(123, root.GetAttributeValue("number", 0));
    Assert.AreEqual("", root.GetAttributeValue("nonexistant", ""));
}
[Test]
public void UpdateExistingAttribute()
{
    var root = new XmlData("root");
    root.AddAttribute("number", "123");
    root.UpdateAttribute("number", "312");
    Assert.AreEqual("312", root.GetAttributeValue("number"));
}
See Also