Ejemplo n.º 1
0
        //private string _relativeFilePath;
        //public override string RelativeFilePath
        //{
        //    get { return _relativeFilePath; }
        //}

        public override XmlElement CreateElement(string prefix, string localName, string namespaceURI)
        {
            XmlElement returnEle = null;

            switch (localName)
            {
            case "hrSample":
                returnEle = new HrSampleXmlElement(this);
                break;

            case "productPropertyGroup":
                returnEle = new ProductPropertyGroupXmlElement(this);
                break;

            case "guestSearch":
                returnEle = new GuestSearchElement(this);
                break;

            case "searchContent":
                returnEle = new SearchContentElement(this);
                break;

            default:
                returnEle = base.CreateElement(prefix, localName, namespaceURI);
                break;
            }

            return(returnEle);
        }
Ejemplo n.º 2
0
        //创建Search内容的相关节点
        public void CreadChildNode(XmlElement nodeElement, string SearchContent)
        {
            bool tagIsEquals = false;
            SearchContentElement childElement = this.OwnerDocument.CreateElement("searchContent") as SearchContentElement;

            if (nodeElement.ChildNodes.Count == 0)
            {
                childElement.SearchContent = SearchContent;
                nodeElement.AppendChild(childElement);
            }
            else
            {
                foreach (SearchContentElement childNode in nodeElement.ChildNodes)
                {
                    if (SearchContent.Equals(childNode.SearchContent))
                    {
                        childElement.SearchContent = SearchContent;
                        nodeElement.RemoveChild(childNode);
                        nodeElement.InsertBefore(childElement, nodeElement.FirstChild);
                        break;
                    }
                    else
                    {
                        tagIsEquals = true;
                    }
                }
                if (tagIsEquals && nodeElement.ChildNodes.Count == 10)
                {
                    childElement.SearchContent = SearchContent;
                    nodeElement.InsertBefore(childElement, nodeElement.FirstChild);
                    XmlNode lastNode = nodeElement.LastChild;
                    nodeElement.RemoveChild(lastNode);
                }
                if (tagIsEquals && nodeElement.ChildNodes.Count < 10)
                {
                    childElement.SearchContent = SearchContent;
                    nodeElement.InsertBefore(childElement, nodeElement.FirstChild);
                }
            }
        }