public function xml($string = true)
    {
        $parser = $this->_parser;
        $xml = new SimpleXMLElement('<shell></shell>');
        $xml->addChild('command', $parser->getCommand());
        $xml->addChild('description', $parser->getDescription());

        $subcommands = $xml->addChild('subcommands');
        foreach ($parser->subcommands() as $command) {
            $command->xml($subcommands);
        }
        $options = $xml->addChild('options');
        foreach ($parser->options() as $option) {
            $option->xml($options);
        }
        $arguments = $xml->addChild('arguments');
        foreach ($parser->arguments() as $argument) {
            $argument->xml($arguments);
        }
        $xml->addChild('epilog', $parser->getEpilog());

        return $string ? $xml->asXML() : $xml;
    }