PHP and XML are confusing, can you help me!!?

  • Thread starter Thread starter Elliot W
  • Start date Start date
E

Elliot W

Guest
Ok, I have some code that is working, just not in the way I want it to. If i have an XML sheet that looks like this:

<sub1>
<sub2 group="2"/>
<sub2 active="1" group="1"/>
</sub1>

How do I use PHP (an IF statement) to choose to use information from the one that has the active="1" attribute. The important part is when the other one doens't have an active atttribute at all, and when I can't add the active attribute to it. I know that otherwise it will use the first one in the list (which is the one without the active attribute) I need it to use attrbutes from the one with active in it, so, in this case i would want it to find the attribute 'group' in the sub section named 'sub2' that has active on it.
 
Back
Top