/**
  * @param XMLElementIterator $elements
  * @param string $attr name of the attribute, '*' for every attribute
  * @param string $pattern pcre based regex pattern for the attribute value
  * @param bool $invert
  * @throws InvalidArgumentException
  */
 public function __construct(XMLElementIterator $elements, $attr, $pattern, $invert = false)
 {
     parent::__construct($elements, $attr);
     if (false === preg_match("{$pattern}", '')) {
         throw new InvalidArgumentException("Invalid pcre pattern '{$pattern}'.");
     }
     $this->pattern = $pattern;
     $this->invert = (bool) $invert;
 }
 /**
  * @param XMLElementIterator $elements
  * @param string $attr name of the attribute, '*' for every attribute
  * @param string|array $compare value(s) to compare against
  * @param bool $invert
  */
 public function __construct(XMLElementIterator $elements, $attr, $compare, $invert = false)
 {
     parent::__construct($elements, $attr);
     $this->compare = (array) $compare;
     $this->invert = (bool) $invert;
 }