static string YamlGetExtension(TagElementStreamFormat format)
        {
            Contract.Requires(format.GetBaseFormat() == TagElementStreamFormat.Yaml);

            if (format.IsText())
            {
                return(".yaml");
            }
            else if (format.IsBinary())             // Yaml doesn't support binary formats
            {
                return(null);
            }

            throw new Debug.UnreachableException(format.ToString());
        }
        static string JsonGetExtension(TagElementStreamFormat format)
        {
            Contract.Requires(format.GetBaseFormat() == TagElementStreamFormat.Json);

            if (format.IsText())
            {
                return(".json");
            }
            else if (format.IsBinary())
            {
                return(".bson");
            }

            throw new Debug.UnreachableException(format.ToString());
        }
        static string XmlGetExtension(TagElementStreamFormat format)
        {
            Contract.Requires(format.GetBaseFormat() == TagElementStreamFormat.Xml);

            if (format.IsText())
            {
                return(".xml");
            }
            else if (format.IsBinary())             // haven't decided on a standard to use yet
            {
                throw new NotImplementedException("General binary XML files not yet implemented");
            }

            throw new Debug.UnreachableException(format.ToString());
        }
        static dynamic YamlOpenFromStream(TagElementStreamFormat format, System.IO.Stream sourceStream,
                                          FileAccess permissions, object owner)
        {
            Contract.Requires(format.GetBaseFormat() == TagElementStreamFormat.Yaml);

            if (format.IsText())
            {
                throw new NotImplementedException();
            }
            else if (format.IsBinary())
            {
                throw new NotSupportedException("Yaml doesn't support binary streams");
            }

            throw new Debug.UnreachableException(format.ToString());
        }
        static dynamic XmlOpenFromStream(TagElementStreamFormat format, System.IO.Stream sourceStream,
                                         FileAccess permissions, object owner)
        {
            Contract.Requires(format.GetBaseFormat() == TagElementStreamFormat.Xml);

            if (format.IsText())
            {
                var stream = new XmlElementStream(sourceStream, permissions, owner);
                stream.InitializeAtRootElement();

                return(stream);
            }
            else if (format.IsBinary())             // haven't decided on a standard to use yet
            {
                throw new NotImplementedException("General binary XML files not yet implemented");
            }

            throw new Debug.UnreachableException(format.ToString());
        }