Document.XMLNodes Property (2007 System)
Gets a XMLNodes collection that represents the collection of all XML elements within the document.
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 XMLNodes As XMLNodes
'Usage
Dim instance As Document
Dim value As XMLNodes
value = instance.XMLNodes
[BrowsableAttribute(false)]
public XMLNodes XMLNodes { get; }
[BrowsableAttribute(false)]
public:
property XMLNodes^ XMLNodes {
XMLNodes^ get ();
}
public function get XMLNodes () : XMLNodes
Property Value
Type: XMLNodes
A XMLNodes collection that represents the collection of all XML elements within the document.
Examples
The following code example displays the names of each of the XMLNodes objects in the document.
This example is for a document-level customization.
Private Sub DocumentXMLNodes()
Dim stringBuilder1 As New System.Text.StringBuilder()
' Add all of the node names to the StringBuilder.
Dim node As Word.XMLNode
For Each node In Me.XMLNodes
stringBuilder1.Append(node.BaseName & ", ")
Next node
' End the StringBuilder with a period.
stringBuilder1.Remove(stringBuilder1.Length - 2, 2)
stringBuilder1.Append(".")
MessageBox.Show("The document contains " & Me.XMLNodes.Count.ToString() _
& " node(s): " & stringBuilder1.ToString())
End Sub
private void DocumentXMLNodes()
{
System.Text.StringBuilder stringBuilder1 =
new System.Text.StringBuilder();
// Add all of the node names to the StringBuilder.
foreach (Word.XMLNode node in this.XMLNodes)
{
stringBuilder1.Append(node.BaseName + ", ");
}
// End the StringBuilder with a period.
stringBuilder1.Remove(stringBuilder1.Length - 2, 2);
stringBuilder1.Append(".");
MessageBox.Show("The document contains " +
this.XMLNodes.Count.ToString() + " node(s): " +
stringBuilder1.ToString());
}
.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.