Problem description: When we deploy infopath in different development servers and product environments, we find that the namespace will change with the small version of infopath.
For example: http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-03-14T09:12:19
Solution:
Use LINQ to XML for obtaining. The encapsulation method is as follows:
Public static string getxmlnamespacebyprefix (string outerxml, string prefix) <br/>{< br/> xelement xmltree = xelement. parse (outerxml); <br/> xnamespace infopathnamespace = xmltree. getnamespaceofprefix (prefix); <br/> return infopathnamespace. tostring (); <br/>}
Call instance:
Xmldocument diposaldoc = new xmldocument (); <br/> diposaldoc. loadxml (dsdisposal); <br/> xnm. addnamespace (constants. _ ip_namespace_dfs_name, utility. getxmlnamespacebyprefix (diposaldoc. outerxml, constants. _ ip_namespace_dfs_name); <br/>