[ create a new paste ] login | about

Link: http://codepad.org/Zm9uSgiH    [ raw code | output | fork ]

PHP, pasted on Nov 6:
<?php
    $xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<config>
   <wrapper>
      <groups>
         <ainfo>
            <label>Information</label>
         </ainfo>
         <atimer>
            <label>Schedule</label>
            <fields>
               <time />
               <frequency />
            </fields>
         </atimer>
         <ajob>
            <label>ajob</label>
            <fields>
               <enable>1</enable>
            </fields>
         </ajob>
         <btimer>
            <label>Schedule</label>
            <fields>
               <time />
               <frequency />
            </fields>
         </btimer>
         <bjob>
            <label>bjob</label>
            <fields>
               <enable>1</enable>
            </fields>
         </bjob>
         <cinfo>
            <label>Information</label>
         </cinfo>
         <cjob>
            <label>cjob</label>
            <fields>
               <enable>1</enable>
            </fields>
         </cjob>
      </groups>
   </wrapper>
</config>
XML;

    $sxe           = new SimpleXMLElement($xml);
    $enabledLabels = $sxe->xpath('//wrapper/groups/*/fields/enable/../../label');

    foreach ($enabledLabels as $enabledLabel) {
        echo "$enabledLabel\n";
    }


Output:
1
2
3
ajob
bjob
cjob


Create a new paste based on this one


Comments: