/// <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); }
/// <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); }
public static bool IsNullorEmptyXElementDecoder(XElementDecoder xDecoder) { return(xDecoder == null || xDecoder == EmptyXElementDecoder); }