Illegal characters in path when loading a string with XDocument

前端 未结 3 1479
心在旅途
心在旅途 2020-12-29 18:16

I have very simple XML in a string that I\'m trying to load via XDocument so that I can use LINQ to XML:

 var xmlString = @\"

        
相关标签:
3条回答
  • 2020-12-29 18:56

    Use this for XML String

            XDocument reader;
            using (StringReader s = new StringReader(**XmlResult**))
            {
                reader = XDocument.Load(s);
            }
    
    0 讨论(0)
  • You are looking for XDocument.Parse - XDocument.Load is for files not xml strings:

    var doc = XDocument.Parse(xmlString); 
    
    0 讨论(0)
  • 2020-12-29 19:17

    Use

    var doc = XDocument.Parse(xmlString); 
    
    0 讨论(0)
提交回复
热议问题