Questions tagged [minidom]

xml.dom.minidom is a Python DOM implementation, part of the standard library. It's use is not recommended, you probably want to use xml.etree.ElementTree instead.

xml.dom.minidom is a minimal XML DOM Level 1 implementation (with Level 2 namespace support added on), part of the Python standard library.

Unless you specifically need to use the DOM API, its use is not recommended. You probably want to use the more Python developer-friendly API instead.

428 questions
127
votes
9 answers

Get Element value with minidom with Python

I am creating a GUI frontend for the Eve Online API in Python. I have successfully pulled the XML data from their server. I am trying to grab the value from a node called "name": from xml.dom.minidom import parse dom = parse("C:\\eve.xml") name =…
RailsSon
  • 19,897
  • 31
  • 82
  • 105
34
votes
2 answers

XML Parsing: Element Tree (etree) vs. minidom

I've been using minidom to parse XML for years. Now I've suddenly learned about Element Tree. My question which is better for parsing? That is: Which is faster? Which uses less memory? Do either have any O(n^2) dependencies I should worry about? Is…
vy32
  • 28,461
  • 37
  • 122
  • 246
30
votes
7 answers

Empty lines while using minidom.toprettyxml

I've been using a minidom.toprettyxml for prettify my xml file. When I'm creating XML file and using this method, all works grate, but if I use it after I've modified the xml file (for examp I've added an additional nodes) and then I'm writing it…
Igal
  • 4,603
  • 14
  • 41
  • 66
26
votes
5 answers

Reading XML using Python minidom and iterating over each node

I have an XML structure that looks like the following, but on a much larger scale: Bob Nigel
GobiasKoffi
  • 4,014
  • 14
  • 59
  • 66
18
votes
1 answer

add element with attributes in minidom python

I want to add a child node with attributes to a specific tag. my xml is and the output should be