Create a document using XmlDocument or insert a node. By default, the xmlns (namespace) feature is generated.
Assume that there is an xml document with the following structure:
Http://www.myWebSite.com/http://www.myWebSite.com/MGID_17 http://www.myWebSite.com/MGID_18
Insert a url node in urlset. The result is as follows:
..............................New Value Here
C # The Code is as follows:
XmlDocument doc = doc. CreateElement (= doc. CreateElement (= );
The result will contain "xmlns" on the url node, which is annoying!
By default, the created Xml node will automatically determine whether its own NameSpace and parent node (for example, the url is inserted into the urlset, And the url's Namespace is consistent with the parent node's Namespace, if they are consistent, they will not be added.
Therefore, the solution is:
XmlDocument doc = doc. CreateElement (doc. DocumentElement. NamespaceURI); XmlElement subEle = doc. CreateElement (newEle. NamespaceURI); subEle. InnerText = );
Conclusion:.