Parse and Query XML code optimisation
Why don't you read the code into a variable and check if it is in the array of codes? After that fill up an array with the results.

Nearly every time you have a variable with a counter in the name, you should use arrays.

Another optimization is using XMLReader::next() to go directly to the next sibling without reading the child nodes.

You don't need to append the imported node, you need to provide it as a context in the DOMXpath::evaluate() calls anyway.

$codes = ["BAS11", "BAS12", "BAS13", "BAS14"];
$hotels = [];

$dom = new DOMDocument();
$xpath = new DOMXPath($dom);

$reader = new XMLReader();
$reader-&gt;open($filename);

// look for the first Hotel element (include descendants)
while ($reader-&gt;read() &amp;&amp; $reader-&gt;localName !== 'Hotel') {
  continue;
}

// while you have an Hotel element
while ($reader-&gt;localName === 'Hotel') {
  // no need to append the node to the document, just import it
  $node = $dom-&gt;importNode($reader-&gt;expand(), true);
  // read the HotelCode
  $code = $xpath-&gt;evaluate('normalize-space(./HotelCode)', $node);
  // if it is in the list
  if (in_array($code, $codes)) {
    // read the values
    $hotels[$code] = [
      'name' =&gt; $xpath-&gt;evaluate('string(./HotelName)', $node),
      'country' =&gt; $xpath-&gt;evaluate('string(./Country)', $node),
      //...
    ];
  }
  // move directly to the next Hotel sibling
  $reader-&gt;next('Hotel');  
}

var_dump($hotels);