Parsing xml string to an xml document fails if the string begins with <?xml… ?> section

前端 未结 5 912
闹比i
闹比i 2021-01-01 11:41

I have an XML file begining like this:




        
5条回答
  •  别那么骄傲
    2021-01-01 12:02

    Try this:

    int startIndex = xmlString.IndexOf('<');
    if (startIndex > 0)
    {
        xmlString = xmlString.Remove(0, startIndex);
    }
    

提交回复
热议问题