开发者

How can I keep a .XML file in memory, then save the document to disc as a regular XML file?

开发者 https://www.devze.com 2022-12-26 05:12 出处:网络
I\'m going to be doing some webscraping and my plan is to have something like this: public class Searcher

I'm going to be doing some webscraping and my plan is to have something like this:

public class Searcher
{
    public void Search(string searchTerm)
    {
    }

    private void Search(string term)
    { 
        //Some HTMLAgilityPack Voodoo here
    }

    private void SaveResults()
    {
        //Actually save the results as .XML file.
    }
}

Is there a way I can keep an .XML file with its contents and everything in memory, and then save the document to disc as a regular XML file开发者_C百科?


Look into XDocument.Load and XDocument.Save with LINQ to XML if you're using .NET 3.5+


Either the XDocument or XmlDocument classes will allow you to keep XML in memory as XML.

0

精彩评论

暂无评论...
验证码 换一张
取 消