Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlEntityNodeAttribute" /> class.
        /// </summary>
        /// <param name="mappingNodeName">Name of the mapping node.</param>
        /// <param name="nodeXPath">The node X path.</param>
        /// <param name="xmlEntityNodeAttributeType">Type of the XML entity node attribute.</param>
        /// <param name="format">The format.</param>
        /// <exception cref="System.Exception">节点映射的名称不能为空。</exception>
        public XmlEntityNodeAttribute(string mappingNodeName, string nodeXPath, XmlEntityNodeFlags xmlEntityNodeAttributeType = XmlEntityNodeFlags.NormalNode, string format = "")
        {
            if (string.IsNullOrEmpty(mappingNodeName.Trim()))
            {
                throw new Exception("The node mapping name can not be empty.");
            }
            Format            = format;
            Name              = mappingNodeName;
            NodeAttributeType = xmlEntityNodeAttributeType;
            if (string.IsNullOrEmpty(nodeXPath.Trim()))
            {
                //设置默认节点的XPath
                XPath = mappingNodeName;
                return;
            }

            XPath = nodeXPath;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XmlEntityNodeAttribute" /> class.
 /// </summary>
 /// <param name="mappingNodeName">Name of the mapping node.</param>
 /// <param name="xmlEntityNodeAttributeType">Type of the XML entity node attribute.</param>
 /// <param name="format">The format.</param>
 public XmlEntityNodeAttribute(string mappingNodeName, XmlEntityNodeFlags xmlEntityNodeAttributeType = XmlEntityNodeFlags.NormalNode, string format = "")
     : this(mappingNodeName, string.Empty, xmlEntityNodeAttributeType, format)
 {
 }