title: Printing data to list styled (table) from XML in Python
body: <p>I'd like to print my servers as listed. Like this:</p>
  
  <pre><code>Machine  | Group               | IP            | Services
  - Alpha  | Public Server Group | 192.168.1.251 | JBoss, Tomcat
  - Public | Public Server Group | 192.168.1.253 | JBoss, Tomcat
  </code></pre>
  
  <p>My XML is:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;AllConfigurations&gt;
  
  &lt;DeployConfigurations&gt;
  
      &lt;Servers&gt;
  
          &lt;Group id="1" name="Public Server Group" username="root" password="mypasswd123" state=""&gt;
              &lt;GApp id="1" name="JBoss Servers" type="JBoss" path="/root/Desktop/jboss-as-7.0.2.Final/" state=""&gt;
                  &lt;Server id="1" name="Alpha" ip="192.168.1.251" path="/root/Desktop/jboss-as-7.0.2.Final/" username="" password="" state="" /&gt;
                  &lt;Server id="2" name="Public" ip="192.168.1.253" path="/root/Desktop/jboss-as-7.0.2.Final/" username="" password="" state="" /&gt;
              &lt;/GApp&gt;
              &lt;GApp id="2" name="Tomcat Servers" type="Tomcat" path="/root/Desktop/apache-tomcat-7.0.22/" state=""&gt;
                  &lt;Server id="1" name="Alpha" ip="192.168.1.251" path="/root/Desktop/apache-tomcat-7.0.22/" username="" password="" state="" /&gt;
                  &lt;Server id="2" name="Public" ip="192.168.1.253" path="/root/Desktop/apache-tomcat-7.0.22/" username="" password="" state="" /&gt;
              &lt;/GApp&gt;
          &lt;/Group&gt;
  
      &lt;/Servers&gt;
  
  &lt;/DeployConfigurations&gt;
  
  &lt;/AllConfigurations&gt;
  </code></pre>
  
  <p>I'm trying to do by this:</p>
  
  <pre><code>from xml.dom.minidom import parse
  
  yXML = parse('/root/Desktop/gb/data/yConfig.xml')
  
  print (' ')
  print ('Machine       |       Group       |       IP       |       Services')
  
  for AllConfigurations in yXML.getElementsByTagName('AllConfigurations'):
      for DeployConfigurations in AllConfigurations.getElementsByTagName('DeployConfigurations'):
          for Servers in DeployConfigurations.getElementsByTagName('Servers'):
              for Group in Servers.getElementsByTagName('Group'):
                  for GApp in Group.getElementsByTagName('GApp'):
                      for Server in Group.getElementsByTagName('Server'):
  
                          print Server.getAttribute('name') + ' | ' + Group.getAttribute('name') + ' | ' + Server.getAttribute('ip') + ' | ' + GApp.getAttribute('type')
  </code></pre>
  
  <p>My result is:</p>
  
  <pre><code>Machine  | Group               | IP            | Services
  Alpha | Public Server Group | 192.168.1.251 | JBoss
  Public | Public Server Group | 192.168.1.253 | JBoss
  Alpha | Public Server Group | 192.168.1.251 | JBoss
  Public | Public Server Group | 192.168.1.253 | JBoss
  Alpha | Public Server Group | 192.168.1.251 | Tomcat
  Public | Public Server Group | 192.168.1.253 | Tomcat
  Alpha | Public Server Group | 192.168.1.251 | Tomcat
  Public | Public Server Group | 192.168.1.253 | Tomcat
  </code></pre>
  
  <p>What should I do?</p>
  
  <p>Its printing for every possibility. I can't align Services side-by-side, print for one IP and look like table.</p>
  
  <p>Need help..</p>