There is no Unicode byte order mark. Cannot switch to Unicode

后端 未结 2 782
灰色年华
灰色年华 2020-12-10 10:25

I am writing an XML validator with XSD.

Below is what I did, but when the validator reached the line while (list.Read()) it gives me the error

2条回答
  •  难免孤独
    2020-12-10 10:49

    The reality of your file's encoding appears to conflict with that specified by your XML declaration. If your file actually uses one-byte characters, declaring encoding="utf-16" won't change it to use two-byte characters, for example.

    Try removing the conflicting encoding from the XML declaration. Replace

    
    

    with

    
    

    You may also be able to load the file into a string as a work-around using LoadXML().

提交回复
热议问题