Namespace: DeltaEngine.Content.Xml
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Content.Xml.Tests.XmlDataTests
6 unit tests call DeltaEngine.Content.Xml.XmlData.GetDescendant(System.String)
Assembly: DeltaEngine.Content.Xml (in DeltaEngine.Content.Xml.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- childName
- Type: System String
Return Value
Type: XmlDataRemarks
Examples
[Test] public void GetDescendant() { XmlData root = CreateDeepTestXmlData(); Assert.AreEqual(root.Children[1], root.GetDescendant(root.Children[1].Name)); Assert.AreEqual(root.Children[1].Children[0], root.GetDescendant("grandchild")); Assert.AreEqual(null, root.GetDescendant("unknown")); }
[Test] public void GetDescendantWithAttribute() { XmlData root = CreateDeepTestXmlData(); Assert.AreEqual(root.Children[0], root.GetDescendant(new XmlAttribute("Attr1", "Value1"))); Assert.AreEqual(root.Children[1].Children[0], root.GetDescendant(new XmlAttribute("Attr5", "Value5"))); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr5", "Value6"))); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr6", "Value5"))); }
[Test] public void GetDescendantWithAttributeAndName() { XmlData root = CreateDeepTestXmlData(); Assert.AreEqual(root.Children[0], root.GetDescendant(new XmlAttribute("Attr1", "Value1"), root.Children[0].Name)); Assert.AreEqual(null, root.GetDescendant(new XmlAttribute("Attr1", "Value1"), root.Children[1].Name)); }
See Also