我有以下xml
<django-objects version="1.0">
<object pk="4613" model="customers.customer">
<field type="CharField" name="username">User A</field>
<field type="CharField" name="email"/>
<field type="BooleanField" name="activo">1</field>
<field type="CharField" name="address">street zz</field>
</object>
<object pk="4644" model="customers.customer">
<field type="CharField" name="username">User B</field>
<field type="CharField" name="email"/>
<field type="BooleanField" name="activo">1</field>
<field type="CharField" name="address">street bla bla</field>
</object>
尝试使用解析它
$xml = simplexml_load_string($url);
接着
foreach ($xml->object as $dato) { print_r($dato['pk']); }
工作正常..但我需要提取用户名...我该怎么做?