开发者

How can I read an xml document/file into a DOM in python?

开发者 https://www.devze.com 2023-01-06 17:29 出处:网络
I need to do screen scraping and for that I need to re开发者_StackOverflowad some xml from python. I want to get a proper DOM tree out of it. How can I do that?Check out the minidom package which also

I need to do screen scraping and for that I need to re开发者_StackOverflowad some xml from python. I want to get a proper DOM tree out of it. How can I do that?


Check out the minidom package which also has examples.

BTW if your screen scraping is HTML don't use XML parsing. There's other stuff for that. (Question about screen scraping, Question about python HTML screen scraping).


The lxml library works well for scraping HTML. Here are some links to get you started:

  • Parsing XML and HTML with lxml
  • lxml: an underappreciated web scraping library
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号