0

i have an XML output and there is a problem in de-serialization ex: MemoItem3 xsi:type="xsd:string"/> i need to remove or replace xsi:type="xsd:string" with an empty and be like MemoItem3 />

note i tried this but not working:

  if (!string.IsNullOrEmpty(IO_StrOut) && IO_StrOut.Contains("xsi:type"))
  {

      Regex.Replace(IO_StrOut, @"\s+xsi:type=""\w+""", "");
  };

here XML i need to replace any xsi:type

<Header>
      <MemoList>
        <MemoItem1 />
        <MemoItem2 />
        <MemoItem3 xsi:type="xsd:string" />
        <MemoItem4 xsi:type="xsd:string">11.1</MemoItem4>
        <MemoItem5 xsi:type="xsd:string">5.0</MemoItem5>
        <MemoItem7 xsi:type="xsd:string">AndroidPhone</MemoItem7>
      </MemoList>
      <User>
        <UserID />
      </User>
      <Service>
        <ServiceID xsi:type="xsd:string">ContactInquiry</ServiceID>
        <ServiceMessageType xsi:type="xsd:string">ContactInquiry</ServiceMessageType>
        <ServiceRequestID xsi:type="xsd:string"></ServiceRequestID>
        <ServiceRequestLanguageCode>EN</ServiceRequestLanguageCode>
        <ServiceResult>
          <ResultCode>0</ResultCode>
          <ResultDesc />
        </ServiceResult>
        <ServiceRequestTime>2020-03-02T18:46:22.163+03:00</ServiceRequestTime>
      </Service>
      <CachingAndExpiryControl />
    </Header>

1 Answers1

0

I don't know about the deserialization but the regex seems wrong as ':' is not a "word" matched with "\w".

Maybe this could match ?