title: How can I turn a xml string into a html table?
body: <p>I have a String and it gives a XML output , now I want to capture that value. But the problem is there are same variables and that needs to run in a loop.</p>
  
  <p>It's a Shipping method activity tracking, means shiftment step by step process and outputing that </p>
  
  <p>Here is the XML I am getting: </p>
  
  <pre><code>&lt;ArrayOfConsignmentTrack xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt;
      &lt;ConsignmentTrack&gt;
          &lt;ERROR/&gt;
          &lt;DOCKNO&gt;AB000000002&lt;/DOCKNO&gt;
          &lt;TRANSIT_LOCATION&gt;ANDHERI BRANCH OFFICE, MUMBAI&lt;/TRANSIT_LOCATION&gt;
          &lt;ACTIVITY&gt;In Transit to&lt;/ACTIVITY&gt;
          &lt;EVENTDATE&gt;13 Apr 2015&lt;/EVENTDATE&gt;
          &lt;EVENTTIME&gt;18:27:40&lt;/EVENTTIME&gt;
          &lt;NEXT_LOCATION&gt;ANDHERI BRANCH OFFICE&lt;/NEXT_LOCATION&gt;
          &lt;TRACKING_CODE&gt;T&lt;/TRACKING_CODE&gt;
      &lt;/ConsignmentTrack&gt;
      &lt;ConsignmentTrack&gt;
          &lt;ERROR/&gt;
          &lt;DOCKNO&gt;AB000000002&lt;/DOCKNO&gt;
          &lt;TRANSIT_LOCATION&gt;OKHLA BRANCH, OKHLA&lt;/TRANSIT_LOCATION&gt;
          &lt;ACTIVITY&gt;Picked up and Booking processed&lt;/ACTIVITY&gt;
          &lt;EVENTDATE&gt;13 Apr 2015&lt;/EVENTDATE&gt;
          &lt;EVENTTIME&gt;17:27:53&lt;/EVENTTIME&gt;
          &lt;NEXT_LOCATION/&gt;
          &lt;TRACKING_CODE&gt;T&lt;/TRACKING_CODE&gt;
      &lt;/ConsignmentTrack&gt;
  &lt;/ArrayOfConsignmentTrack&gt;
  </code></pre>
  
  <p>Now I want a output like this:</p>
  
  <p><img src="https://i.stack.imgur.com/OZMqQ.jpg" alt="enter image description here"></p>
  
  <p>I am using this code to get the value </p>
  
  <pre><code>$myXMLData = file_get_contents($URL);
  
  $xml = (array)simplexml_load_string($myXMLData);
  if($xml) {
      $dataArray = (array)$xml['ConsignmentTrack'];
      echo $DOCKNO = $dataArray['DOCKNO'];
      echo $TRANSIT_LOCATION =  $dataArray['TRANSIT_LOCATION'];
      echo $ACTIVITY =  $dataArray['ACTIVITY'];
      echo $EVENTDATE =  $dataArray['EVENTDATE'];
      echo $EVENTTIME =  $dataArray['EVENTTIME'];
      echo $NEXT_LOCATION =  $dataArray['NEXT_LOCATION'];
  } else{
      echo "  -  Invalid Docket No.";
  }
  </code></pre>
  
  <p>But it's giving only one value. What loop structure do I have to use?</p>