Remove q1 and all namespaces from xml

前端 未结 3 969
渐次进展
渐次进展 2021-01-18 22:14

I\'m given a xsd generated C# POCO object that I need to convert to xml. The expected payload however doesn\'t match the xsds I was given. Specifically, I need to omit the

3条回答
  •  走了就别回头了
    2021-01-18 22:36

    I sometimes use RegEx or XML Linq

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Xml;
    using System.Xml.Linq;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                string input =
                    "\n" +
                        "\n" +
                            "1.4\n" +
                        "\n" +
                        "v" +
                            "WMSkuCap0180\n" +
                            "\n" +
                                "EACH\n" +
                                "3\n" +
                            "\n" +
                            "1\n" +
                        "\n" +
                    "\n";
    
                string pattern1 = @"<[^/][^:]+:";
                string output = Regex.Replace(input, pattern1, "<");
                string pattern2 = @"

提交回复
热议问题