/// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses WebDav_Prop from 'DAV:prop' element.
        /// </summary>
        /// <param name="propNode">The 'DAV:prop' element</param>
        /// <returns>Returns DAV prop.</returns>
        /// <exception cref="ArgumentNullException">Is raised when when <b>propNode</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when there are any parsing error.</exception>
        internal static WebDav_Prop Parse(XmlNode propNode)
        {
            if (propNode == null)
            {
                throw new ArgumentNullException("propNode");
            }

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

            WebDav_Prop retVal = new WebDav_Prop();

            foreach (XmlNode node in propNode.ChildNodes)
            {
                // Resource type property.
                if (string.Equals(node.LocalName, "resourcetype", StringComparison.InvariantCultureIgnoreCase))
                {
                    retVal.m_pProperties.Add(WebDav_p_ResourceType.Parse(node));
                }
                // Default name-value property.
                else
                {
                    retVal.m_pProperties.Add(new WebDav_p_Default(node.NamespaceURI, node.LocalName, node.InnerXml));
                }
            }

            return(retVal);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Parses WebDav_Prop from 'DAV:prop' element.
        /// </summary>
        /// <param name="propNode">The 'DAV:prop' element</param>
        /// <returns>Returns DAV prop.</returns>
        /// <exception cref="ArgumentNullException">Is raised when when <b>propNode</b> is null reference.</exception>
        /// <exception cref="ParseException">Is raised when there are any parsing error.</exception>
        internal static WebDav_Prop Parse(XmlNode propNode)
        {
            if(propNode == null){
                throw new ArgumentNullException("propNode");
            }

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

            WebDav_Prop retVal = new WebDav_Prop();

            foreach(XmlNode node in propNode.ChildNodes){
                // Resource type property.
                if(string.Equals(node.LocalName,"resourcetype",StringComparison.InvariantCultureIgnoreCase)){
                    retVal.m_pProperties.Add(WebDav_p_ResourceType.Parse(node));
                }
                // Default name-value property.
                else{
                    retVal.m_pProperties.Add(new WebDav_p_Default(node.NamespaceURI,node.LocalName,node.InnerXml));
                }
            }

            return retVal;
        }