Thanks for Oleg's suggestion.
Hi Manoj G,
As for the Manipulation XmlNamespace in .net's System.Xml apis, I haven't
found any direct means for modifying the xml namespaceURI or prefix in
XmlDocument (they're readonly). However, if you just want to modify
(remove) the default namespace declaration, we can use the Attributes
collection of XmlDocument.DocumentElement to modify/remove namespace
declaration, for example:
doc.documentElement.RemoveAttribute("xmlns")
Or if you want to mofiying namespace Prefix for elements, we can use the
following means:
XmlDocument doc = new XmlDocument();
doc.LoadXml("<a:test xmlns:a='123' xmlns:b='456'/>");
XmlElement e = doc.DocumentElement;
e.Prefix = "b";
Console.WriteLine(doc.InnerXml);
#Changing Namespace Declarations in an XML Document
http://msdn.microsoft.com/library/en...gingnamespacex
mlnsdeclarationsinxmldocument.asp?frame=true
#Changing Namespace Prefix Properties
http://msdn.microsoft.com/library/en...gingnamespacep
refixproperties.asp?frame=true
In addition, I think Oleg's suggestion on using XmlWriter to filtering
prefix (or using xslt transformation) is a efficient means for document
based replacing. Here is a certain article mentioned remove namespace
prefix through a customized Writer:
#How Do I Remove Namespaces Using XSLT?
http://blogs.msdn.com/kaevans/archiv...16/132959.aspx
Hope also helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)