XMLNode.ChildNodes Property (2007 System)
Gets a XMLNodes collection that represents the child elements of an XMLNode control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ChildNodes As XMLNodes
'Usage
Dim instance As XMLNode
Dim value As XMLNodes
value = instance.ChildNodes
[BrowsableAttribute(false)]
public XMLNodes ChildNodes { get; }
[BrowsableAttribute(false)]
public:
property XMLNodes^ ChildNodes {
XMLNodes^ get ();
}
public function get ChildNodes () : XMLNodes
Property Value
Type: XMLNodes
A XMLNodes collection that represents the child elements of an XMLNode control.
Examples
The following code example uses the ChildNodes property to create a list of the names of all child nodes of an XMLNode control. It then displays the list in a message box. This example assumes that the current document contains an XMLNode named CustomerNode.
Private Sub DisplayChildNodes()
Dim childNodeNames As New System.Text.StringBuilder()
If Me.CustomerNode.HasChildNodes Then
childNodeNames.Append(Me.CustomerNode.BaseName & _
" has the children: ")
Dim childElement As Word.XMLNode
For Each childElement In Me.CustomerNode.ChildNodes
childNodeNames.Append(" " & childElement.BaseName)
Next childElement
MsgBox(childNodeNames.ToString())
Else
MsgBox("'" & Me.CustomerNode.BaseName & _
"' has no child nodes.")
End If
End Sub
private void DisplayChildNodes()
{
System.Text.StringBuilder childNodeNames =
new System.Text.StringBuilder();
if (this.CustomerNode.HasChildNodes)
{
childNodeNames.Append(this.CustomerNode.BaseName +
" has the children: ");
foreach (Word.XMLNode childElement in this.CustomerNode.ChildNodes)
{
childNodeNames.Append(" " + childElement.BaseName);
}
MessageBox.Show(childNodeNames.ToString());
}
else
{
MessageBox.Show("'" + this.CustomerNode.BaseName +
"' has no child nodes.");
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.