How to efficiently store this parsed XML document in MySQL Database using Python?

前端 未结 1 408
醉话见心
醉话见心 2021-01-02 23:34

Following is the XML file : book.xml




    
                


        
相关标签:
1条回答
  • 2021-01-03 00:28

    Based on your comment above, I would simply create a book class, an author class, an author list, and a chapter class. Assign the chapters of the book to a list of Chapter objects on the Book itself. Maintain the AuthorList as a dict of their IDs, pointing to the actual Author objects. Use a data member of the Book object to contain the ID; you can provide a method to pull the author out of the AuthorList dict for convenience.

    0 讨论(0)
提交回复
热议问题