Skip to content
Advertisement

Read XML line by line without loading whole file to memory

This is structure of my XML:

JavaScript

Can I load every row one by one without loading whole XML file into memory? For example printing all of the titles

Advertisement

Answer

Providing the XML file is structured exactly as shown in the example then BeautifulSoup could be used to parse relevant lines. Something like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement