title: Inserting XML into MySQL
body: <p>I am trying to insert some XML into a MySQL table but am having some trouble because I only want to insert certain attributes and not all the attributes in the XML file. </p>
  
  <p>Here is subset of the XML:
  <code>
  &lt;rosters&gt;
      &lt;team id="1" team_name="Ravens"&gt;</code><code>
          &lt;players&gt;
              &lt;player id="28" jersey_number="34" first_name="Joe" last_name="Flacco"/&gt;
              &lt;player id="4" jersey_number="43" first_name="Ray" last_name="Lewis"/&gt;
          &lt;/players&gt;
      &lt;/team&gt;
      &lt;team id="2" team_name="Broncos"&gt;
          &lt;players&gt;
              &lt;player id="9" jersey_number="5" first_name="Peyton" last_name="Manning"/&gt;
          &lt;/players&gt;
      &lt;/team&gt;
  &lt;/rosters&gt;
  </code></p>
  
  <p>I want to loop through each team and insert the players on the team with certain attributes. </p>
  
  <p>These would be the columns in the MySQL table: player_id(primary key and autoincrement), first_name, last_name, and the player's respective team.</p>
  
  <p>This would be the desired table after inserting the attributes:</p>
  
  <pre><code>player_id, first_name, last_name,   team
          1,        Joe,    Flacco,  Ravens
          2,        Ray,     Lewis,  Ravens
          3,     Peyton,   Manning, Broncos
  </code></pre>
  
  <p>I am new to XML and most of the answers I have found usually insert all elements into a single table. It would be much appreciated if someone could help me with my specific question or direct me to a resource. </p>