protected function createAsAvailable(): XmlStreamWriter
    {
        foreach (array_keys($this->types) as $xmlExtension) {
            if (extension_loaded($xmlExtension)) {
                return $this->createStreamWriter($xmlExtension);
            }
        }

        throw new XmlException(
                'No supported xml extension available, can not create a xml stream writer!'
        );
    }