I'm using XPath to parse an XML file. Instead of printing out the elements value I want to print out an attribute. For example:
<users>
<moderators>
<user1 postcount="50">
<permissions>
<editposts>true</editposts>
<deleteposts>true</deleteposts>
</permissions
</user1>
</moderators>
<standard_users>
<user2 postcount="21">
<permissions>
<editposts>false</editposts>
<deleteposts>false</deleteposts>
</permissions
</user2>
<user3 postcount="32">
<permissions>
<editposts>false</editposts>
<deleteposts>false</deleteposts>
</permissions
</user3>
<user4 postcount="13">
<permissions>
<editposts>false</editposts>
<deleteposts>false</deleteposts>
</permissions
</user4>
</standard_users>
</users>
So in terms of the code above I want to use an XPath query (/users/standard_users/*) and print out the post count for all the standard users. At the moment I can use a foreach loop to get the nodes inside the user block ($n->textContent) but is there a way to print out the attributes of a specific element (postcount = "13").
I hope the above makes sense, if not please tell me and I'll attempt to clarify the post.
Thanks