src/Loader/XmlLoader.php
public function load($filename)
    {
        $mediaTypes = new MediaTypeCollection();

        $xml = simplexml_load_file($filename);

        foreach ($xml->mediatype as $mediatypeNode) {
            $attrs = $mediatypeNode->attributes();
            $name = (string) $attrs['name'];
            $category = (string) $attrs['category'];

            $mimetypes = [];
            if ($mediatypeNode->mimetypes->count() && $mediatypeNode->mimetypes->mimetype->count()) {
                foreach ($mediatypeNode->mimetypes->mimetype as $mimetypeNode) {
                    $mimetypes[] = (string) $mimetypeNode;
                }
            }

            $attributes = [];
            if ($mediatypeNode->attributes->count() && $mediatypeNode->attributes->attribute->count()) {
                foreach ($mediatypeNode->attributes->attribute as $attributeNode) {
                    $attrs = $attributeNode->attributes();
                    $attributes[(string) $attrs['key']] = (string) $attributeNode;
                }
            }

            $mediaType = new MediaType($name, $category, $mimetypes, $attributes);

            $mediaTypes->add($mediaType);
        }

        return $mediaTypes;
    }
public function load($filename)
    {
        $mediaTypes = new MediaTypeCollection();

        $xml = simplexml_load_file($filename);

        foreach ($xml->mediatype as $mediatypeNode) {
            $attrs = $mediatypeNode->attributes();
            $name = (string) $attrs['name'];
            $category = (string) $attrs['category'];

            $mimetypes = [];
            if ($mediatypeNode->mimetypes->count() && $mediatypeNode->mimetypes->mimetype->count()) {
                foreach ($mediatypeNode->mimetypes->mimetype as $mimetypeNode) {
                    $mimetypes[] = (string) $mimetypeNode;
                }
            }

            $attributes = [];
            if ($mediatypeNode->attributes->count() && $mediatypeNode->attributes->attribute->count()) {
                foreach ($mediatypeNode->attributes->attribute as $attributeNode) {
                    $attrs = $attributeNode->attributes();
                    $attributes[(string) $attrs['key']] = (string) $attributeNode;
                }
            }

            $mediaType = new MediaType($name, $category, $mimetypes, $attributes);

            $mediaTypes->add($mediaType);
        }

        return $mediaTypes;
    }
{@inheritdoc}