سلام بر تمامی برنامه نویسان #C 😉 در این پست کد پبمایش در XmlDocument به صورت بازگشتی در #C را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
کد پبمایش در XmlDocument به صورت بازگشتی در #C :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
public class MainClass
{
public static void Main()
{
XmlDocument document = new XmlDocument();
document.Load("Books.xml");
RecurseXmlDocument((XmlNode)document.DocumentElement);
}
private static void RecurseXmlDocument(XmlNode root)
{
if (root is XmlElement)
{
Console.WriteLine(root.Name);
if (root.HasChildNodes)
RecurseXmlDocument(root.FirstChild);
if (root.NextSibling != null)
RecurseXmlDocument(root.NextSibling);
}
else if (root is XmlText)
{
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
public class MainClass
{
public static void Main()
{
XmlDocument document = new XmlDocument();
document.Load("Books.xml");
RecurseXmlDocument((XmlNode)document.DocumentElement);
}
private static void RecurseXmlDocument(XmlNode root)
{
if (root is XmlElement)
{
Console.WriteLine(root.Name);
if (root.HasChildNodes)
RecurseXmlDocument(root.FirstChild);
if (root.NextSibling != null)
RecurseXmlDocument(root.NextSibling);
}
else if (root is XmlText)
{