1
I am in need of removing the Xnamespace that enters as default on an rss return. Follow the code below:
static void Main(string[] args)
{
XNamespace ns = "http://search.yahoo.com/mrss";
var item = new XElement(ns + "content",
new XAttribute(XNamespace.Xmlns + "media", ns),
new XAttribute("duration", "512"),
new XAttribute("type", "video/mp4"),
new XAttribute("url", "http://tv-download.dw.de/dwtv_video/flv/gle/gle20140609_ghana_sd_sor.mp4"),
new XElement(ns + "thumbnail", new XAttribute(XNamespace.Xmlns + "media", ns),
new XAttribute("url", "http://www.dw.de/image/0,,17611287_403,00.jpg"),
new XAttribute("type", "image/jpeg"),
new XAttribute("height", "480"),
new XAttribute("width", "853")),
new XElement(ns + "title",
new XAttribute(XNamespace.Xmlns + "media", ns), "Video caption"),
new XElement(ns + "description",
new XAttribute(XNamespace.Xmlns + "media", ns), "description"),
new XElement(ns + "copyright",
new XAttribute(XNamespace.Xmlns + "media", ns), "Francisco Cunha, 2014"));
Console.WriteLine(item);
Console.ReadLine();
}
Can you please put in your question which XML is expected and which XML is being generated?
– Leonel Sanches da Silva
I need to remove the xmlns:media="" value by only returning the nos values without it for example the value in <media:copyright>Francisco Cunha, 2014</media:copyright> not so <media:copyright xmlns:media="http://search.yahoo.com/mrss">Francisco Cunha, 2014</media:copyright> I’m mounting an rss and have to remove this xmlns from all the ones I’m riding.
– thiago.adriano26