示例#1
0
        public HTMLTableRowElement InsertRow(Int32 index)
        {
            var rows   = Rows;
            var newRow = OwnerDocument.CreateElement(Tags.Tr) as HTMLTableRowElement;

            if (index >= 0 && index < rows.Length)
            {
                var row = rows[index];
                row.ParentElement.InsertBefore(newRow, row);
            }
            else if (rows.Length == 0)
            {
                var bodies = TBodies;

                if (bodies.Length == 0)
                {
                    var tbody = OwnerDocument.CreateElement(Tags.Tbody);
                    AppendChild(tbody);
                }

                bodies[bodies.Length - 1].AppendChild(newRow);
            }
            else
            {
                rows[rows.Length - 1].ParentElement.AppendChild(newRow);
            }

            return(newRow);
        }
示例#2
0
        public void CreateElement()
        {
            CreateList();
            if (list != null)
            {
                if (list.Contains(UserAddNumber))
                {
                    MessageService.Show("该编号以存在");
                    return;
                }
            }
            XmlNode createrNumberNode = OwnerDocument.SelectSingleNode("//userAddNumber");

            if (createrNumberNode == null)
            {
                XmlElement newCreateNumberEle = OwnerDocument.CreateElement("userAddNumber");
                OwnerDocument.DocumentElement.AppendChild(newCreateNumberEle);
                createrNumberNode = (XmlNode)newCreateNumberEle;
            }
            string  eleNode = PageName + "UserCreateNumber";
            XmlNode node    = OwnerDocument.SelectSingleNode("//" + eleNode + "");

            if (node == null)
            {
                XmlElement newEle = OwnerDocument.CreateElement(PageName + "UserCreateNumber");
                createrNumberNode.AppendChild(newEle);
                node = (XmlNode)newEle;
            }
            XmlElement ele = OwnerDocument.CreateElement("numberItem");

            ele.SetAttribute("number", UserAddNumber);
            node.AppendChild(ele);
            OwnerDocument.Save();
        }
示例#3
0
        /// <summary>
        /// Insert a new empty row in the table.
        /// </summary>
        public HtmlElement InsertRow(int index)
        {
            var row = (HtmlTableRowElement)OwnerDocument.CreateElement(TagsNames.Tr);

            var rows = Rows.ToList();

            if (index > rows.Count)
            {
                throw new Exception("The index provided (" + index + ") is greater than the number of rows in the table (" + rows.Count + ")");
            }

            if (rows.Count == 0 || index == -1)
            {
                if (TBodies.Count == 0)
                {
                    var tbody = OwnerDocument.CreateElement(TagsNames.TBody);
                    tbody.AppendChild(row);
                    AppendChild(tbody);
                }
                else
                {
                    TBodies.Last().AppendChild(row);
                }
            }
            else
            {
                var beforeRow = rows[index];
                beforeRow.ParentNode.InsertBefore(row, beforeRow);
            }

            return(row);
        }
示例#4
0
        /// <include file='doc\XmlElement.uex' path='docs/doc[@for="XmlElement.CloneNode"]/*' />
        /// <devdoc>
        ///    <para>Creates a duplicate of this node.</para>
        /// </devdoc>
        public override XmlNode CloneNode(bool deep)
        {
            Debug.Assert(OwnerDocument != null);
            bool OrigLoadingStatus = OwnerDocument.IsLoading;

            OwnerDocument.IsLoading = true;
            XmlElement element = OwnerDocument.CreateElement(Prefix, LocalName, NamespaceURI);

            if (element.IsEmpty != IsEmpty)
            {
                element.IsEmpty = this.IsEmpty;
            }
            OwnerDocument.IsLoading = OrigLoadingStatus;

            if (HasAttributes)
            {
                foreach (XmlAttribute attr in Attributes)
                {
                    XmlAttribute newAttr = (XmlAttribute)(attr.CloneNode(true));
                    if (attr is XmlUnspecifiedAttribute && attr.Specified == false)
                    {
                        (( XmlUnspecifiedAttribute )newAttr).SetSpecified(false);
                    }
                    element.Attributes.Append(newAttr);
                }
            }
            if (deep)
            {
                element.CopyChildren(this, deep);
            }

            return(element);
        }
示例#5
0
        public XmlElement CreateAttributeElement(string name)
        {
            XmlElement ele = OwnerDocument.CreateElement("attribute");

            ele.SetAttribute("name", name);
            return(ele);
        }
示例#6
0
        public XmlElement CreateChannelElement(string channelId)
        {
            XmlElement ele = OwnerDocument.CreateElement("channel");

            ele.SetAttribute("id", channelId);
            return(ele);
        }
示例#7
0
 /// <summary>
 /// Create a table footer row or return an existing one.
 /// </summary>
 public HtmlElement CreateTFoot()
 {
     if (TFoot == null)
     {
         AppendChild(OwnerDocument.CreateElement(TagsNames.TFoot));
     }
     return(TFoot);
 }
示例#8
0
 /// <summary>
 /// Create a new table caption object or return an existing one.
 /// </summary>
 public HtmlElement CreateCaption()
 {
     if (Caption == null)
     {
         AppendChild(OwnerDocument.CreateElement(TagsNames.Caption));
     }
     return(Caption);
 }
示例#9
0
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            var element = OwnerDocument.CreateElement(prefix, localName, ns);

            Current.AppendChild(element);
            Current     = element;
            _writeState = WriteState.Element;
        }
示例#10
0
        public override XmlNode Clone()
        {
            AnyXmlElement targetEle = OwnerDocument.CreateElement(this.Name)
                                      as AnyXmlElement;

            XmlUtilService.CopyXmlElement(this, targetEle);
            return(targetEle);
        }
示例#11
0
 /// <summary>
 /// Create a table header row or return an existing one.
 /// </summary>
 public HtmlElement CreateTHead()
 {
     if (THead == null)
     {
         AppendChild(OwnerDocument.CreateElement(TagsNames.THead));
     }
     return(THead);
 }
示例#12
0
        protected override DomObject SetNameCore(DomName name)
        {
            var newElement = OwnerDocument.CreateElement(name);

            newElement.Append(ChildNodes.ToList());
            newElement.Attributes.AddRange(Attributes.ToList());
            newElement.CopyAnnotationsFrom(AnnotationList);
            return(ReplaceWith(newElement));
        }
        public INode Add(string nodeName, string @namespace)
        {
            XmlNode nativeNode = OwnerDocument.CreateElement(nodeName, @namespace);

            Node.AppendChild(nativeNode);
            INode node = new Node(nativeNode, Node, _document);

            _nodes.Add(node);
            return(node);
        }
示例#14
0
        public HTMLTableSectionElement CreateTFoot()
        {
            var foot = TFoot;

            if (foot == null)
            {
                foot = OwnerDocument.CreateElement(Tags.Tfoot) as HTMLTableSectionElement;
                AppendChild(foot);
            }

            return(foot);
        }
示例#15
0
        public HTMLTableCaptionElement CreateCaption()
        {
            var caption = Caption;

            if (caption == null)
            {
                caption = OwnerDocument.CreateElement(Tags.Caption) as HTMLTableCaptionElement;
                AppendChild(caption);
            }

            return(caption);
        }
示例#16
0
        public HTMLTableSectionElement CreateTHead()
        {
            var head = THead;

            if (head == null)
            {
                head = OwnerDocument.CreateElement(Tags.Thead) as HTMLTableSectionElement;
                AppendChild(head);
            }

            return(head);
        }
        public DomNode Wrap(DomName element)
        {
            var result = Wrap(OwnerDocument.CreateElement(element));

            // HACK Copy XMLNS attribute (this should be possible via the name context)
            foreach (var attr in Attributes)
            {
                if (attr.Prefix == "xmlns" || attr.LocalName.StartsWith("xmlns:"))
                {
                    result.Attribute(attr.Name, attr.Value);
                }
            }
            return(result);
        }
示例#18
0
        internal override DomElement ApplyToElement(DomElement newElement)
        {
            var caseElement = OwnerDocument.CreateElement("c:case");

            foreach (var child in OwnerElement.Elements.ToArray())
            {
                child.AppendTo(caseElement);
            }

            this.OwnerElement.Append(caseElement);


            return(newElement);
        }
示例#19
0
        public HTMLTableCellElement InsertCell(Int32 index)
        {
            var cell    = _cells[index];
            var newCell = OwnerDocument.CreateElement(Tags.Td) as HTMLTableCellElement;

            if (cell != null)
            {
                InsertBefore(newCell, cell);
            }
            else
            {
                AppendChild(newCell);
            }

            return(newCell);
        }
示例#20
0
        protected override DomNode CloneCore()
        {
            DomElement result = OwnerDocument.CreateElement(Name);

            foreach (var m in Attributes)
            {
                result.Attributes.Add(m.Clone());
            }
            foreach (var m in ChildNodes)
            {
                result.Append(m.Clone());
            }
            result.CopyAnnotationsFrom(AnnotationList);

            return(result);
        }
        public HTMLTableRowElement InsertRow(Int32 index)
        {
            var row    = Rows[index];
            var newRow = OwnerDocument.CreateElement(HTMLTableRowElement.Tag) as HTMLTableRowElement;

            if (row != null)
            {
                InsertBefore(newRow, row);
            }
            else
            {
                AppendChild(newRow);
            }

            return(newRow);
        }
示例#22
0
        /// <summary>
        /// Insert an empty TD cell into this row.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public HtmlElement InsertCell(int index = -1)
        {
            var newCell = (HtmlElement)OwnerDocument.CreateElement("td");

            var cells = Cells;

            if (cells.Count == 0 || index == -1)
            {
                AppendChild(newCell);
            }

            var cell = Cells[index];

            InsertBefore(newCell, cell);

            return(newCell);
        }
示例#23
0
        /// <summary>
        /// Insert a row into this section.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public HtmlElement InsertRow(int index = -1)
        {
            var row = (HtmlElement)OwnerDocument.CreateElement(TagsNames.Tr);

            var rows = Rows;

            if (rows.Count == 0 || index == -1)
            {
                AppendChild(row);
            }
            else
            {
                InsertBefore(row, rows[index]);
            }

            return(row);
        }
示例#24
0
        // Clone this node in either shallow or deep mode.
        public override XmlNode CloneNode(bool deep)
        {
            XmlElement clone = OwnerDocument.CreateElement
                                   (Prefix, LocalName, NamespaceURI);

            if (attributes != null)
            {
                foreach (XmlAttribute attr in Attributes)
                {
                    clone.Attributes.Append
                        ((XmlAttribute)(attr.CloneNode(true)));
                }
            }
            if (deep)
            {
                clone.CloneChildrenFrom(this, deep);
            }
            return(clone);
        }
示例#25
0
        public override XmlNode CloneNode(bool deep)
        {
            XmlElement node = OwnerDocument.CreateElement(
                name.Prefix, name.LocalName, name.NS, true);

            for (int i = 0; i < Attributes.Count; i++)
            {
                node.SetAttributeNode((XmlAttribute)
                                      Attributes [i].CloneNode(true));
            }

            if (deep)
            {
                for (int i = 0; i < ChildNodes.Count; i++)
                {
                    node.AppendChild(ChildNodes [i].CloneNode(true), false);
                }
            }

            return(node);
        }
示例#26
0
        public XmlElement CreateAttributeListElement()
        {
            XmlElement ele = OwnerDocument.CreateElement("attributes");

            return(ele);
        }
 public DomElement CreateElement(DomName name)
 {
     return(OwnerDocument.CreateElement(name));
 }
 public DomElement CreateElement(string name)
 {
     return(OwnerDocument.CreateElement(name));
 }
示例#29
0
        public XmlElement CreateChannelListElement()
        {
            XmlElement _channelIdListEle = OwnerDocument.CreateElement("channels");

            return(_channelIdListEle);
        }