Exemplo n.º 1
0
        }//end of AddAttribute.

        /// <summary>
        /// 加入單一 XPathNode 子節點並且回傳該子節點物件
        /// </summary>
        /// <param name="pSubNode">XPathNode 物件</param>
        /// <returns>XPathNode 物件</returns>
        public XPathNode AddSubNode(XPathNode pSubNode)
        {
            if (SubNodes.IndexOf(pSubNode) == -1)
            {
                SubNodes.Add(pSubNode);
            } //end of if.
            return(pSubNode);
        }     //end of AddSubNode.
Exemplo n.º 2
0
        }     //end of AddSubNode.

        /// <summary>
        ///
        /// </summary>
        /// <param name="pNameArray"></param>
        public void AddMultiLayerSubNode(string[] pNameArray)
        {
            XPathNode oParentNode = this;

            for (int i = 0; i < pNameArray.Length; i++)
            {
                XPathNode oChildNode = new XPathNode(pNameArray[i]);
                oParentNode.AddSubNode(oChildNode);
                oParentNode = oChildNode;
            } //end of for.
        }     //end of AddMultiLayerSubNode.
Exemplo n.º 3
0
        }//end of GetEntity.

        /// <summary>
        /// 取得標簽結構的物件
        /// </summary>
        /// <param name="Layer1Name">第一層標簽字串</param>
        /// <param name="Layer2Name">第二層標簽字串</param>
        /// <returns>XPathNode 物件</returns>
        public static XPathNode CreateEntity(string xpath)
        {
            try
            {
                XPathNode oXPathNode = new XPathNode(xpath);
                return(oXPathNode);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }//end of GetEntity.
Exemplo n.º 4
0
        }//end of constructor.

        /// <summary>
        /// 取得兩層標簽結構的物件
        /// </summary>
        /// <param name="Layer1Name">第一層標簽字串</param>
        /// <param name="Layer2Name">第二層標簽字串</param>
        /// <returns>XPathNode 物件</returns>
        public static XPathNode CreateEntity(string Layer1Name, string Layer2Name)
        {
            try
            {
                XPathNode oXPathNode = new XPathNode(Layer1Name);
                oXPathNode.AddSubNode(new XPathNode(Layer2Name));
                return(oXPathNode);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }//end of GetEntity.
Exemplo n.º 5
0
        }//end of constructor.

        #endregion

        #region Method Member

        /// <summary>
        /// 取得段落父節點
        /// </summary>
        /// <param name="pCurrentTagLength"></param>
        /// <param name="pNode1"></param>
        /// <param name="pNode2"></param>
        /// <param name="pNode3"></param>
        /// <param name="pNode4"></param>
        /// <param name="pNode5"></param>
        /// <returns></returns>
        private XPathNode GetLastNode(int pCurrentTagLength, XPathNode pNode1, XPathNode pNode2, XPathNode pNode3, XPathNode pNode4, XPathNode pNode5)
        {
            XPathNode oResult = null;

            switch (pCurrentTagLength)
            {
            case 2:
                if (pNode1 != null)
                {
                    oResult = pNode1;
                }
                break;

            case 3:
                if (pNode2 != null)
                {
                    oResult = pNode2;
                }
                break;

            case 4:
                if (pNode3 != null)
                {
                    oResult = pNode3;
                }
                break;

            case 5:
                if (pNode4 != null)
                {
                    oResult = pNode4;
                }
                break;
            } //end of switch.
            return(oResult);
        }     //end of GetLastNode().
Exemplo n.º 6
0
        }     //end of AddAttribute.

        /// <summary>
        ///
        /// </summary>
        /// <param name="pAttribute"></param>
        public void AddAttribute(XPathNode pAttribute)
        {
            AddAttribute(pAttribute.Name, pAttribute.Value);
        }//end of AddAttribute.