例如
XmlNamespaceManager nsmgr = new XmlNamespaceManager(myxmldocument.NameTable);
nsmgr.AddNamespace("xdp", "http://ns.adobe.com/xdp/");
nsmgr.AddNamespace("config", "http://www.xfa.org/schema/xci/1.0/");
同样如何在XDocument中添加?
答案 0 :(得分:0)
string s = myXDocument.ToString();//my XDocument corresponds to our existing XDocument
XPathDocument xpath = new XPathDocument(new StringReader(s));
XPathNavigator pathnavigator= xpath .CreateNavigator();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(pathnavigator.NameTable);