I think it's probably important to ask why you use XML to store 300,000 records. Since XML is not the most efficient format for managing data using.
If you are stuck in XML, it might be best for you to read the XML file into some kind of database (you can leave with a memory table, but then you might run out of memory). I think that if you use the TXMLDocument object to load an XML file, you will have a serious performance problem or run out of memory (I had problems when I played with the xml x 250k file some time ago).
Perhaps you can directly use the MSXML DOM (perhaps you can import the type library) or use SAX, which will allow you to parse it sequentially, none of which I have had much experience.
source share