示例#1
0
        /// <summary>
        /// Parses WebDav_PropStat from 'DAV:propstat' element.
        /// </summary>
        /// <param name="propstatNode">The 'DAV:propstat' element</param>
        /// <returns>Returns DAV propstat.</returns>
        /// <exception cref="ArgumentNullException">Is raised when when <b>propstatNode</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when there are any parsing error.</exception>
        internal static WebDav_PropStat Parse(XmlNode propstatNode)
        {
            if (propstatNode == null)
            {
                throw new ArgumentNullException("propstatNode");
            }

            // Invalid response.
            if (!string.Equals(propstatNode.NamespaceURI + propstatNode.LocalName, "DAV:propstat", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ParseException("Invalid DAV:propstat value.");
            }

            WebDav_PropStat retVAl = new WebDav_PropStat();

            foreach (XmlNode node in propstatNode.ChildNodes)
            {
                if (string.Equals(node.LocalName, "status", StringComparison.InvariantCultureIgnoreCase))
                {
                    retVAl.m_Status = node.ChildNodes[0].Value;
                }
                else if (string.Equals(node.LocalName, "prop", StringComparison.InvariantCultureIgnoreCase))
                {
                    retVAl.m_pProp = WebDav_Prop.Parse(node);
                }
            }

            return(retVAl);
        }
示例#2
0
        /// <summary>
        /// Parses WebDav_PropStat from 'DAV:propstat' element.
        /// </summary>
        /// <param name="propstatNode">The 'DAV:propstat' element</param>
        /// <returns>Returns DAV propstat.</returns>
        /// <exception cref="ArgumentNullException">Is raised when when <b>propstatNode</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when there are any parsing error.</exception>
        internal static WebDav_PropStat Parse(XmlNode propstatNode)
        {
            if(propstatNode == null){
                throw new ArgumentNullException("propstatNode");
            }

            // Invalid response.
            if(!string.Equals(propstatNode.NamespaceURI + propstatNode.LocalName,"DAV:propstat",StringComparison.InvariantCultureIgnoreCase)){
                throw new ParseException("Invalid DAV:propstat value.");
            }

            WebDav_PropStat retVAl = new WebDav_PropStat();

            foreach(XmlNode node in propstatNode.ChildNodes){
                if(string.Equals(node.LocalName,"status",StringComparison.InvariantCultureIgnoreCase)){
                    retVAl.m_Status = node.ChildNodes[0].Value;
                }
                else if(string.Equals(node.LocalName,"prop",StringComparison.InvariantCultureIgnoreCase)){
                    retVAl.m_pProp = WebDav_Prop.Parse(node);
                }                
            }

            return retVAl;
        }