The test tool I use produces xml files that I am parsing and inserting into a mysql database. I then have a set of php pages that report on the test results.
I wrote a C# console application that parses the xml file and performs the db insert. I am using MySQLDriverCS as the interface to mysql.
The problem I am having is that it is a little slow. One of the bottlenecks I have is looking for the version string in the xml file. I created a Regex to look for the version string:
That should find a version string like 8.0.1.123. This is relatively quick, but then I need to retrieve the version number and I do that with this:
That code appears to be what is extremely slow. I crate ResContentsArra y like this:
So, how can I regex search for the version string and return it relatively quickly.
Currently the XML files are around 750-850k in size but are likely to grow with time.
Getting the version string is all part of setting up the result_set which contains a product version, platform, architecture, server, date, etc. Once I have a result_set id, I can start inserting the body of the tests and associate them to that result_set.
I would like to find a faster way to import the xml result data into my mysql database. I am currently using
and then I XmlIn.Read() till I get to nodes I am looking for. I then build the SQL insert query and execute it. Is there a faster way?
I wrote a C# console application that parses the xml file and performs the db insert. I am using MySQLDriverCS as the interface to mysql.
The problem I am having is that it is a little slow. One of the bottlenecks I have is looking for the version string in the xml file. I created a Regex to look for the version string:
Code:
Regex VersionRegex = new Regex(".*[1-9][.][0-9][.][0-9][.][0-9].*");
Code:
foreach (string Word in ResContentsArray) { if (VersionRegex.IsMatch(Word)) { VersionString = Word.Split('<')[0]; break; } }
Code:
// put the xml file into my text reader FileInfo ResFileInfo = new FileInfo(this.ResultFile); StreamReader ResStream = ResFileInfo.OpenText(); string ResContents = ResStream.ReadToEnd(); string[] ResContentsArray = ResContents.Split(' '); ResStream.Close(); ResStream.Dispose();
Currently the XML files are around 750-850k in size but are likely to grow with time.
Getting the version string is all part of setting up the result_set which contains a product version, platform, architecture, server, date, etc. Once I have a result_set id, I can start inserting the body of the tests and associate them to that result_set.
I would like to find a faster way to import the xml result data into my mysql database. I am currently using
Code:
XmlReader XmlIn = new XmlTextReader("c:\\file.xml");