예제 #1
0
        public DateTime GetNodeDate(XmlNode xmlNode, string strElementName, DateTime dtDefault)
        {
            DateTime date = dtDefault;

            try
            {
                NodeContent content     = new NodeContent(strElementName);
                string      strDateTime = GetNodeContent(xmlNode, content);
                date = DateTimeExt.Parse(strDateTime);
            }
            catch (Exception ex)
            {
                Utils.DbgOutExc("FeedManager::GetNodeDate()", ex);
            }
            return(date);
        }
예제 #2
0
        public string GetNodeContent(XmlNode xmlNode, NodeContent nodeContent)
        {
            string strContent = null;

            try
            {
                XmlNode node = null;
                if (m_nsManager != null)
                {
                    node = xmlNode.SelectSingleNode(nodeContent.m_strXPath, m_nsManager);
                }
                else
                {
                    node = xmlNode.SelectSingleNode(nodeContent.m_strXPath);
                }
                if (node != null)
                {
                    if (nodeContent.m_ncType == NCType.Xml)
                    {
                        strContent = node.InnerXml;
                    }
                    else if ((node.ChildNodes.Count == 1) && (node.FirstChild.NodeType == XmlNodeType.CDATA))
                    {
                        strContent = node.InnerText;
                    }
                    else if (nodeContent.m_ncType == NCType.Text)
                    {
                        strContent = System.Web.HttpUtility.HtmlDecode(node.InnerText);
                    }

                    if (strContent != null)
                    {
                        strContent = strContent.Trim();
                    }
                }
            }
            catch (System.Xml.XPath.XPathException)
            {
                // This is fine: Namespace prefix 'xyz' is not defined.
            }
            catch (Exception ex)
            {
                Utils.DbgOutExc("FeedManager::GetNodeContent()", ex);
            }
            return(strContent);
        }
예제 #3
0
        public string GetNodeContent(XmlNode xmlNode, string strXPath)
        {
            NodeContent content = new NodeContent(strXPath);

            return(GetNodeContent(xmlNode, content));
        }
예제 #4
0
        public string GetNodeContent(XmlNode xmlNode, string strXPath, NCEncoding ncEncoding, NCType ncType)
        {
            NodeContent content = new NodeContent(strXPath, ncEncoding, ncType);

            return(GetNodeContent(xmlNode, content));
        }