TX Text Control .NET for WPF

GetChildItem Method

Method
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Returns an XML Element object that represents a child element of this element.

Syntax

GetChildItem(string)

Returns the first XML child element with the specified name.

public XmlElement GetChildItem(string name);
ParameterDescription
name

Specifies the name of the sub-element.

GetChildItem(string, int)

Returns the XML child element with the specified name and index.

public XmlElement GetChildItem(string name, int index);
ParameterDescription
name

Specifies the name of the sub-element.

index

Specifies the number of the sub-element beginning with 1. If this value does not match any existing sub-element, an error occurs.

Return Value

The return value is a valid XmlElement object.

Examples

The following example gets the Telephone element from the second address in an XML document that contains adresses consisting of the sub-elements Name, Street, City and Telephone:

XmlElement element = textControl1.GetXmlElements("Adress").GetItem(2).GetChildItem("Telephone");

The following example retrieves child item from the xml element.

XmlElement result = xmlElement.GetChildItem("CustomerName", 1);
result?.Select();