Jump to content
skaterdav85

simplexml parsing

Recommended Posts

I did a print_r on a simplexml object and I get the following:

SimpleXMLElement Object(	[@attributes] => Array		(			[term] => Standards			[scheme] => Responsible Organization		) )

How do I access @attributes? I want to get the array element [scheme]. $root->@attributes throws a syntax error because of the @ symbol.

Share this post


Link to post
Share on other sites

You get them by calling the attributes() method over the element you're on.So,

print_r($root->attributes());

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...