public void EnumNextSibling()
{
Document doc = new Document();
//ExStart
//ExFor:CompositeNode.FirstChild
//ExFor:Node.NextSibling
//ExFor:Node.NodeTypeToString
//ExFor:Node.NodeType
//ExSummary:Shows how to enumerate immediate child nodes of a composite node using NextSibling. In this example we enumerate all paragraphs of a section body.
// Get the section that we want to work on.
Section section = doc.Sections[0];
Body body = section.Body;
// Loop starting from the first child until we reach null.
for (Node node = body.FirstChild; node != null; node = node.NextSibling)
{
// Output the types of the nodes that we come across.
Console.WriteLine(Node.NodeTypeToString(node.NodeType));
}
//ExEnd
}