.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sharon Maxwell

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to remove namespace attribute from a xml file ?

Posted By: Sajid P K     Posted Date: October 11, 2010    Points:2   Category :C#
Hi All,

<?xml version="1.0" encoding="US-ASCII" ?>
<doc xmlns="http://rtf2xml.sourceforge.net/">
<preamble> </preamble>

from above XML. How we will remove attribute xmlns="http://rtf2xml.sourceforge.net/" ?

Sajid P K

Author: Sathakkathul Haq             
Posted Date: October 12, 2010     Points: 5   

Below code snippet is useful to remove the namespace from the xml file.

XmlDocument doc = new XmlDocument();
using (XmlTextReader reader= new XmlTextReader("C:\\Read.xml"))
reader.Namespaces = false;

I hope it's useful.

with regards,
M.Sathakkathul Haq

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend