title: SimpleXML Skipping Attributes
body: <p><strong>Test XML:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Transfer&gt;
      &lt;ABR recordLastUpdatedDate="20180329" replaced="N"&gt;
          &lt;ABN status="ACT" ABNStatusFromDate="20000214"&gt;80007321682&lt;/ABN&gt;
          &lt;EntityType&gt;
              &lt;EntityTypeInd&gt;PUB&lt;/EntityTypeInd&gt;
              &lt;EntityTypeText&gt;Australian Public Company&lt;/EntityTypeText&gt;
          &lt;/EntityType&gt;
          &lt;MainEntity&gt;
              &lt;NonIndividualName type="MN"&gt;
                  &lt;NonIndividualNameText&gt;BLACK CABS COMBINED PTY LTD&lt;/NonIndividualNameText&gt;
              &lt;/NonIndividualName&gt;
              &lt;BusinessAddress&gt;
                  &lt;AddressDetails&gt;
                      &lt;State&gt;VIC&lt;/State&gt;
                      &lt;Postcode&gt;3166&lt;/Postcode&gt;
                  &lt;/AddressDetails&gt;
              &lt;/BusinessAddress&gt;
          &lt;/MainEntity&gt;
      &lt;/ABR&gt;
  &lt;/Transfer&gt;
  </code></pre>
  
  <p><strong>PHP Script:</strong></p>
  
  <pre><code>$f='test.xml';
  $reader=new XMLReader();
  $reader-&gt;open($f);
  while($reader-&gt;read()){
      if($reader-&gt;nodeType==XMLReader::ELEMENT &amp;&amp; $reader-&gt;name=='ABR'){
          $doc=new DOMDocument('1.0','UTF-8');
          $xml=simplexml_import_dom($doc-&gt;importNode($reader-&gt;expand(),true));
          print_r($xml);
      }
  }
  $reader-&gt;close();
  </code></pre>
  
  <p><strong>PHP Output:</strong></p>
  
  <pre><code>SimpleXMLElement Object
  (
      [@attributes] =&gt; Array
          (
              [recordLastUpdatedDate] =&gt; 20180329
              [replaced] =&gt; N
          )
  
      [ABN] =&gt; 80007321682
      [EntityType] =&gt; SimpleXMLElement Object
          (
              [EntityTypeInd] =&gt; PUB
              [EntityTypeText] =&gt; Australian Public Company
          )
  
      [MainEntity] =&gt; SimpleXMLElement Object
          (
              [NonIndividualName] =&gt; SimpleXMLElement Object
                  (
                      [@attributes] =&gt; Array
                          (
                              [type] =&gt; MN
                          )
  
                      [NonIndividualNameText] =&gt; BLACK CABS COMBINED PTY LTD
                  )
  
              [BusinessAddress] =&gt; SimpleXMLElement Object
                  (
                      [AddressDetails] =&gt; SimpleXMLElement Object
                          (
                              [State] =&gt; VIC
                              [Postcode] =&gt; 3166
                          )
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p><strong>The Problem:</strong></p>
  
  <p>The attributes for the <code>ABN</code> element (<code>status</code> and <code>ABNStatusFromDate</code>) are not in the output, even though other attributes are.</p>
  
  <p>Please help me understand why those attributes in particular are missing.</p>
  
  <p><em>PS - Dummy text so SO doesn't give me warnings about my post being mostly code</em></p>