0

I have a string with XML in it, like this

string xml="<?xml version=\"1.0\" encoding=\"utf-16\"?>
            <UserInfo xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>  
                <UserName>First_User</UserName>  
                <Age>25</Age>  
            </UserInfo>";

I have to add namespace attribute to UserInfo node like this,without removing the existing ones

<UserInfo xmlns:'abc'>

This is what I am doing

XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xml);

when I write xmlDoc.SelectNodes("UserInfo"),its not selecting any node How can I add attribute to UserInfo?

ZwoRmi
  • 1,093
  • 11
  • 30
Syed Salman Raza Zaidi
  • 2,172
  • 9
  • 42
  • 87

0 Answers0