I have a large xml
file which contains database!
400mb
is a size.
it was created using LINQ
itself and it was done in 10 minutes
! Great result!
But in order to read a particle information from that xml
file using LINQ
it need 20 minutes and more!
Just imagine to read a small amount of information needs more time then to write a large information!
During read process it needs to call a function XDocument.Load(@"C:\400mb.xml")
which is not IDisposable
.
So when it will load whole xml document and when it gets my small information, Memory does not clears!
My target is to read "
XDocument XD1 = XDocument.Load(@"C:\400mb.xml");
string s1 = XD1.Root.Attribute("AnyAttribute").Value;
As you can see, I need to get an Attribute of the Root Element.
This means that in xml
file the data I need might be on a first line and query must be done very quickly!
But instead of this it load whole Document and then returns that information!
So the question is How to read that small amount of information from a large xml
file using anything?
Will System.Threading.Tasks
namespace be useful? Or create asynchronous operations?
Or is even any kind of technique which will work on that xml file like a binary
file?
I don't know! Help me Please!