0

I'm creating a program to read to SVN to see what files have changed in each commit.

I've got the program getting the data and storing it into a string. What I now need to do is to analyze the data. I do not want to create an xml file as I've done it before. I'm unsure how to analyze the data this is may code where it's reading an xml file.

private void Show_Click(object sender, System.EventArgs e)
{
    FileStream fileStream = null;
    fileStream = new FileStream(Path.Combine(_filePath, @"svn.log"), FileMode.Open, FileAccess.Read, FileShare.Read);


    XmlSerializer xmlSerializer = new XmlSerializer(typeof(log));
    log logInstance;
    lock (xmlSerializer)
    {
        logInstance = (log)xmlSerializer.Deserialize(fileStream);
    }
    _dictionary = CreateDictionary(logInstance);
    converToText(_dictionary);
}
2
  • And what exactly is the problem? On which particular point are you stuck? Do you get an error? Commented Sep 23, 2015 at 13:10
  • I'm not sure how to get the string to be passed into the xmlSerializer.Deserialize. I have all the data in a string and i want that string to read the string and display the output. Previously I've had it as an xml file but have changed it to have the data in a string as the way the xml file was created made it difficult to run on a new file Commented Sep 23, 2015 at 13:14

1 Answer 1

1

You may use a simple StringReader for this:

var serializer = new XmlSerializer(typeof(log));
log logInstance;

using (TextReader reader = new StringReader(myXmlString))
{
    logInstance = serializer.Deserialize(reader);
}

Which reads from a string instead of a file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.