title: Output certain fields of the xml file via php
body: <p>I extracted bios settings from the server in xml file and would like to use php to only show 2 fields of that xml file.</p>
  
  <p>This is the xml file I have (named ndphlsv02.xml)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SystemConfiguration Model="PowerEdge R720" ServiceTag="xxxxxx" TimeStamp="Wed Aug 12 08:23:51 2015"&gt;
      &lt;Component FQDD="LifecycleController.Embedded.1"&gt;
          &lt;Attribute Name="LCAttributes.1#CollectSystemInventoryOnRestart"&gt;Enabled&lt;/Attribute&gt;
          &lt;Attribute Name="LCAttributes.1#PartConfigurationUpdate"&gt;Apply always&lt;/Attribute&gt;
          &lt;Attribute Name="LCAttributes.1#PartFirmwareUpdate"&gt;Match firmware of replaced part&lt;/Attribute&gt;
      &lt;/Component&gt;
      &lt;Component FQDD="System.Embedded.1"&gt;
          &lt;Attribute Name="LCD.1#Configuration"&gt;Service Tag&lt;/Attribute&gt;
          &lt;Attribute Name="ThermalConfig.1#CriticalEventGenerationInterval"&gt;30&lt;/Attribute&gt;
          &lt;Attribute Name="ThermalConfig.1#EventGenerationInterval"&gt;30&lt;/Attribute&gt;
      &lt;/Component&gt;
      &lt;Component FQDD="iDRAC.Embedded.1"&gt;
          &lt;Attribute Name="IPMILan.1#Enable"&gt;Enabled&lt;/Attribute&gt;
          &lt;Attribute Name="IPMILan.1#PrivLimit"&gt;Administrator&lt;/Attribute&gt;
      &lt;/Component&gt;
      &lt;Component FQDD="RAID.Integrated.1-1"&gt;
          &lt;Attribute Name="RAIDresetConfig"&gt;False&lt;/Attribute&gt;
          &lt;Attribute Name="RAIDforeignConfig"&gt;Ignore&lt;/Attribute&gt;
          &lt;Attribute Name="RAIDrekey"&gt;False&lt;/Attribute&gt;
      &lt;/Component&gt;
      &lt;Component FQDD="RAID.Slot.4-1"&gt;
          &lt;Attribute Name="RAIDresetConfig"&gt;False&lt;/Attribute&gt;
          &lt;Attribute Name="RAIDforeignConfig"&gt;Ignore&lt;/Attribute&gt;
      &lt;/Component&gt;
      &lt;Component FQDD="BIOS.Setup.1-1"&gt;
          &lt;Attribute Name="MemTest"&gt;Disabled&lt;/Attribute&gt;
          &lt;Attribute Name="MemOpMode"&gt;OptimizerMode&lt;/Attribute&gt;
          &lt;Attribute Name="NodeInterleave"&gt;Disabled&lt;/Attribute&gt;
          &lt;Attribute Name="AcPwrRcvry"&gt;Last&lt;/Attribute&gt;
          &lt;Attribute Name="AcPwrRcvryDelay"&gt;Immediate&lt;/Attribute&gt;
          &lt;Attribute Name="NumLock"&gt;On&lt;/Attribute&gt;
          &lt;Attribute Name="ReportKbdErr"&gt;Report&lt;/Attribute&gt;
      &lt;/Component&gt;
  &lt;/SystemConfiguration&gt;
  </code></pre>
  
  <p>Here's the php code I have so far:</p>
  
  <pre><code>$xml = simplexml_load_file('ndphlsv02.xml') or die("Error: Cannot create object");
  
  $power=$xml-&gt;Component[5]-&gt;Attribute[3];
  $power_attr = $xml-&gt;Component[5]-&gt;Attribute[3]-&gt;attributes();
  $status=$xml-&gt;Component[5]-&gt;Attribute[4];
  $status_attr = $xml-&gt;Component[5]-&gt;Attribute[4]-&gt;attributes();
  echo $power_attr .": ". $power."&lt;br&gt;";
  echo $status_attr .": ". $status;
  </code></pre>
  
  <p>This works fine but I will have about 100 xml files extracted from each server and I noticed that the  and  and  that I need to extract could be in totally different places. So this will not work anymore:</p>
  
  <pre><code>Component[5]-&gt;Attribute[3]
  </code></pre>
  
  <p>Is there a way for me to search all xml files and output only the "Attributes" whose names are "AcPwrRcvry" and "AcPwrRcvryDelay" and their values?</p>
  
  <p>Thank you.</p>