コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="elem">可以为 NULL</param>
        /// <returns></returns>
        public XElementDecoder Element(string elem)
        {
            XElementDecoder result;

            if (elemItem == null || elem == null)
            {
                logger.Debug("Element elemItem or elemPara is NULL ---- elemPara=" + elem);
                result = EmptyXElementDecoder;
            }
            else
            {
                try
                {
                    XElement xelem = elemItem.Element(elem);
                    if (xelem != null)
                    {
                        result = new XElementDecoder(xelem);
                    }
                    else
                    {
                        logger.Debug("this Elem will be empty with " + elem);
                        result = EmptyXElementDecoder;
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Element Error in XElementDecoder", ex);
                    result = EmptyXElementDecoder;
                }
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 转换XmlElement 为 XElementDecoder
        /// </summary>
        /// <param name="xelem"></param>
        /// <returns></returns>
        public static XElementDecoder Parse(XmlElement xelem)
        {
            XElementDecoder result = new XElementDecoder();

            if (xelem == null)
            {
                result.elemItem = null;
            }
            else
            {
                result.elemItem = XElement.Parse(xelem.OuterXml);
            }

            return(result);
        }
コード例 #3
0
 public static bool IsNullorEmptyXElementDecoder(XElementDecoder xDecoder)
 {
     return(xDecoder == null || xDecoder == EmptyXElementDecoder);
 }