code: private static function getAttribute(SimpleXMLElement $component, $name, $format)
      {
          $attributes = $component->attributes();
          if (isset($attributes[$name])) {
              if ($format == 'string') {
                  return (string) $attributes[$name];
              } elseif ($format == 'integer') {
                  return (int) $attributes[$name];
              } elseif ($format == 'boolean') {
                  return (bool) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
              }
  
              return (float) $attributes[$name];
          }
  
          return null;
      }
docs: @param SimpleXMLElement $component
  @param string $name
  @param string $format
  
  @return null|bool|float|int|string