Remove xml: base attribute from XDocument

I am currently having trouble removing the troublesome attribute from my root xdocument node: xml: base .

My Xdocument currentDoc :

<root xml:base="texthere"> <child/> </root> 

I looked at the xml: base documentation here: http://www.w3.org/TR/xmlbase/ .

I am having problems with C # code to get rid of this because this xml: prefix does not have a declaration like other namespace prefixes.

This is what I have that doesn't work:

 currentDoc.Root.Attributes().Where(a => a.IsNamespaceDeclaration).Remove(); 
+4
source share
1 answer

The xml namespace is defined:

 currentDoc.Root.Attributes(XNamespace.Xml + "base").Remove(); 
+1
source

Source: https://habr.com/ru/post/1496928/


All Articles