30
C#を使用してXMLからすべての名前空間を削除する方法
すべてのXML要素から名前空間を削除するためのクリーンでエレガントでスマートなソリューションを探していますか?それを行うにはどのように機能しますか? 定義されたインターフェース: public interface IXMLUtils { string RemoveAllNamespaces(string xmlDocument); } NSを削除するサンプルXML: <?xml version="1.0" encoding="utf-16"?> <ArrayOfInserts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <insert> <offer xmlns="http://schema.peters.com/doc_353/1/Types">0174587</offer> <type2 xmlns="http://schema.peters.com/doc_353/1/Types">014717</type2> <supplier xmlns="http://schema.peters.com/doc_353/1/Types">019172</supplier> <id_frame xmlns="http://schema.peters.com/doc_353/1/Types" /> <type3 xmlns="http://schema.peters.com/doc_353/1/Types"> <type2 /> <main>false</main> </type3> <status xmlns="http://schema.peters.com/doc_353/1/Types">Some state</status> </insert> </ArrayOfInserts> RemoveAllNamespaces(xmlWithLotOfNs)を呼び出した後、次を取得する必要があります。 <?xml version="1.0" encoding="utf-16"?> <ArrayOfInserts> <insert> <offer >0174587</offer> <type2 >014717</type2> <supplier >019172</supplier> …