Copy XML Attributes - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Copy XML Attributes

Demo Code

// All rights reserved.
using System.Diagnostics;
using System.Collections.Specialized;
using System.Xml;
using System.Data;
using System;/*  w  w w.ja  v  a  2s .c  o m*/

public class Main{
        public static void CopyAttributes(DataRow fromRow, XmlNode toNode)
      {
         foreach (DataColumn col in fromRow.Table.Columns)
         {
            CreateAttribute(toNode, col.ColumnName, fromRow[col.ColumnName].ToString());
         }
      }
}

Related Tutorials