private function parsePackage($packageInfo)
    {
        $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
        $channelName = (string) $packageInfo->p->c;
        $packageName = (string) $packageInfo->p->n;
        $license = (string) $packageInfo->p->l;
        $shortDescription = (string) $packageInfo->p->s;
        $description = (string) $packageInfo->p->d;

        $dependencies = array();
        foreach ($packageInfo->xpath('ns:deps') as $node) {
            $dependencyVersion = (string) $node->v;
            $dependencyArray = unserialize((string) $node->d);

            $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);

            $dependencies[$dependencyVersion] = $dependencyInfo;
        }

        $releases = array();
        $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
        if ($releasesInfo) {
            foreach ($releasesInfo as $node) {
                $releaseVersion = (string) $node->v;
                $releaseStability = (string) $node->s;
                $releases[$releaseVersion] = new ReleaseInfo(
                    $releaseStability,
                    isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
                );
            }
        }

        return new PackageInfo(
            $channelName,
            $packageName,
            $license,
            $shortDescription,
            $description,
            $releases
        );
    }