XmlDocument.Load Vs XmlDocument.LoadXml

前端 未结 5 1493
面向向阳花
面向向阳花 2021-01-07 18:41

I just came across with a problem using XmlDocument.LoadXml.

The application was crashing, giving the following error:

\"Data at

5条回答
  •  难免孤独
    2021-01-07 19:21

    Were you trying to use XmlDocument.LoadXml and passing in the name of a file? It doesn't do that - it assumes that the string you pass in is the XML. So you might use:

    doc.LoadXml("");
    

    or

    doc.Load("myfile.xml");
    

    If that doesn't help, could you show your failing and working code? There are different ways you could have changed from using LoadXml to Load...

提交回复
热议问题