First of all, I'm concerned to hear you talking about number of lines when processing XML. In most cases, an XML document, without the line breaks, is still the same document. Lines don't matter.
Second, you didn't say which RDBMS you're using, but I'll assume SQL Server 2005 or 2008. In this case, if this is a process that you will need to repeat often, then I suggest you do this in SQL Server Integration Services (SSIS). SSIS is optimized for this sort of thing. In particular, it can actually be reading from the XML file, performing your per-row modifications, and writing batches of prepared rows to the database, all at the same time.
The only potential issue would be with the size of the file (BTW, you said it's 20 million lines, but how many MB is that?). SSIS tries to load the entire document into memory at once. This can be a problem. To combat this, I found it relatively easy to create my own custom Source component. This looked under the root element of the document, and returned one child element (and its descendants) at a time. This was simple to do by using the XmlReader.ReadSubTree method, which returns a new XmlReader that only processes the current element and all of its children.