/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="node">The node describing the seealso xml element.</param>
        internal SeeAlsoXmlCodeElement(XmlNode node)
            : base(XmlCodeElements.SeeAlso)
        {
            if (node.Attributes["cref"] == null)
            {
                throw new AttributeRequiredException("cref", XmlCodeElements.SeeAlso);
            }

            _member = CRefPath.Parse(node.Attributes["cref"].Value);
            switch (_member.PathType)
            {
            case CRefTypes.Type:
                Text = _member.TypeName;
                break;

            case CRefTypes.Namespace:
                Text = _member.Namespace;
                break;

            default:
                if (!string.IsNullOrEmpty(Member.ElementName))
                {
                    Text = _member.ElementName;
                }
                else if (!string.IsNullOrEmpty(node.Attributes["cref"].Value))
                {
                    Text = node.Attributes["cref"].Value.Substring(2);
                }
                break;
            }
            IsInline = true;
        }
Exemple #2
0
        internal SeeXmlCodeElement(XmlNode node)
            : base(XmlCodeElements.See)
        {
            if (node.Attributes["cref"] == null)
            {
                throw new AttributeRequiredException("cref", XmlCodeElements.See);
            }

            _member = CRefPath.Parse(node.Attributes["cref"].Value);
            switch (Member.PathType)
            {
            case CRefTypes.Type:
                Text = _member.TypeName;
                break;

            case CRefTypes.Namespace:
                Text = _member.Namespace;
                break;

            default:
                Text = _member.ElementName;
                break;
            }
            IsInline = true;
        }
Exemple #3
0
        /// <summary>
        /// Initialises a new instance of the ExceptionXmlCodeElement class.
        /// </summary>
        /// <param name="node">The node describing the exception.</param>
        public ExceptionXmlCodeElement(XmlNode node)
            : base(XmlCodeElements.Exception)
        {
            if (node.Attributes["cref"] == null)
            {
                throw new AttributeRequiredException("cref", XmlCodeElements.Exception);
            }

            Elements = Parse(node);
            _member  = CRefPath.Parse(node.Attributes["cref"].Value);
        }
        /// <summary>
        /// Initialises a new instance of the PermissionXmlCodeElement class.
        /// </summary>
        /// <param name="node">The XML node representing the permission details.</param>
        /// <exception cref="AttributeRequiredException">The cref attribute was missing.</exception>
        internal PermissionXmlCodeElement(XmlNode node)
            : base(XmlCodeElements.Permission)
        {
            if (node.Attributes["cref"] == null)
            {
                throw new AttributeRequiredException("cref", XmlCodeElements.Permission);
            }

            _member  = CRefPath.Parse(node.Attributes["cref"].Value);
            Elements = Parse(node);
            IsBlock  = true;
        }
        /// <summary>
        /// Parses the provided path and returns a populated cref path instance.
        /// </summary>
        /// <param name="crefPath">The cref path to control.</param>
        /// <exception cref="ArgumentNullException">The specified path was null or empty.</exception>
        public static CRefPath Parse(string crefPath)
        {
            if (string.IsNullOrEmpty(crefPath))
            {
                throw new ArgumentNullException("path");
            }

            CRefPath parsedPath = new CRefPath();

            parsedPath._crefPath = crefPath;
            parsedPath.Parse();

            return(parsedPath);
        }