An "xmlns" attribute is not a normal attribute. It is parsed as an
XNamespace, so cannot be removed so simply.

You could use something like the code in the following article to
remove the Namespace, however:
http://tinyurl.com/yc52d9z

On Nov 22, 3:00 am, Vic <[email protected]> wrote:
> I think anyone could run this code and see the problem. On the last
> line, if you look at the content of the xB object in your debugger,
> you'll see the "xmlns" attribute, even though it's removed in the
> previous command. I've tried variations on this idea, like a while
> (xB.Attribute("xmlns") != null). Can anyone tell me why the "xmlns"
> attribute is not removed from this object?
>
> xBlog is an <asp:Xml> object on the page. This code is in the
> Page_Load event in a ASP.Net app using the 3.5 framework.
>
> HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"http://
> charliescowboyblog.blogspot.com/feeds/posts/default");
> HttpWebResponse response = (HttpWebResponse)req.GetResponse();
> Stream stream = response.GetResponseStream();
> StreamReader reader = new StreamReader(stream, Encoding.UTF8);
> XElement xB = XElement.Parse(reader.ReadToEnd());
> response.Close();
> reader.Close();
> xB.Attribute("xmlns").Remove();
> xBlog.DocumentContent = xB.ToString();

Reply via email to