简体   繁体   中英

splitting an exml file into smaller files

the xml file contains information about movies. how do i split the xml file into smaller files? ( so each small file is a separate movie)

Without knowing the details, here is a broad outline of a possible approach:

  1. Parse the XML using a suitable library ( BeautifulSoup , lxml etc.)
  2. Find the element corresponding to each movie. This can be done using a plain findAll or may require using an XPATH expression.
  3. Pretty print the subtree starting corresponding to each movie element into separate files.

Of course a more detailed answer is not possible unless you post some sample XML and provide more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM