python - Parsing large XML file to find data linked to another piece of data -


I have a 9 MB XML file that contains information about the system in which I am writing scripts. The small files named system symbols each have a tick type in each symbol and related to a property .

Data stored in this format.

  & lt; Symbol symbol name = "name" property = "property" tick type = "type" />  

I currently write 3 files by parse the file, each contains a list of three things.

What I need to do is a list or a dictionary in the dictionary that all the symbols can be written in a file and their related type and property are written on any other part of the file.

The result of the result is an html file with a dropdown where you select and property and it displays symbols and each symbol the type .

My current method of parsing is using the xml.dom.minidom module and then using getElementsByTagName it's all about 3 lists that I want but do not link them with related members of other lists

follwing Install Libs

  Install pipes, install beautifulSuppose 4 pipe flask  

and then pod of PDO OG code from BSE import In

  beautiful flask import soup flask, request, jsonify xml = '' '\ & lt; Symbol symbol name = "e" estate = "e1" ticketype = "t1" /> & Lt; Symbol symbol name = "b" estate = "e1" ticketype = "t2" /> & Lt; Symbol symbol name = "c" estate = "e1" ticketype = "t2" /> & lt; Symbol symbol name = "d" estates = "e2" ticketype = "t2" /> '' 'Soup = Beautiful soup (XML) symbols = soup.fund_all (' symbol ') app = flask (__name__) @ app. Root ("/") DRF filter_symbols (): barrier = request.Eggs ('Estate', none) property_in_req = 'property' jsonify in request.args (symbols = [{'name': SGT ('symbol name'), 'type': s.get ('ticketype 'No, property_in_reck or s.get (' property ') == barrier]] If __name__ == "__main__": app.run (debug = true)  

You now have a webserver

{"symbols": [{ "Name": "a", "type": "t1"}, {"name": "b", "type": "t2"}, {"name": "c", "type": "T2"}}}

in your browser

I hope you can use the code snippet to proceed with your solution.

If you have performance problems database.;)

- Brunsgard


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -