Deciding on when to use XmlDocument vs XmlReader

前端 未结 5 1091
陌清茗
陌清茗 2020-11-28 02:54

I\'m optimizing a custom object -> XML serialization utility, and it\'s all done and working and that\'s not the issue.

It worked by loading a file into an Xml

5条回答
  •  眼角桃花
    2020-11-28 03:38

    Another consideration is that XMLReader might be more robust for handling less-than-perfectly-formed XML. I recently created a client which consumed an XML stream, but the stream didn't have the special characters escaped correctly in URIs contained in some of the elements. XMLDocument and XPathDocument refused to load the XML at all, whereas using XMLReader I was able to extract the information I needed from the stream.

提交回复
热议问题