Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        public XmlElement CreateAttributeElement(string name)
        {
            XmlElement ele = OwnerDocument.CreateElement("attribute");

            ele.SetAttribute("name", name);
            return(ele);
        }
Exemplo n.º 6
0
        public XmlElement CreateChannelElement(string channelId)
        {
            XmlElement ele = OwnerDocument.CreateElement("channel");

            ele.SetAttribute("id", channelId);
            return(ele);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
        }
Exemplo n.º 10
0
        public override XmlNode Clone()
        {
            AnyXmlElement targetEle = OwnerDocument.CreateElement(this.Name)
                                      as AnyXmlElement;

            XmlUtilService.CopyXmlElement(this, targetEle);
            return(targetEle);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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));
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        public HTMLTableSectionElement CreateTFoot()
        {
            var foot = TFoot;

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

            return(foot);
        }
Exemplo n.º 15
0
        public HTMLTableCaptionElement CreateCaption()
        {
            var caption = Caption;

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

            return(caption);
        }
Exemplo n.º 16
0
        public HTMLTableSectionElement CreateTHead()
        {
            var head = THead;

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

            return(head);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
 }
Exemplo n.º 29
0
        public XmlElement CreateChannelListElement()
        {
            XmlElement _channelIdListEle = OwnerDocument.CreateElement("channels");

            return(_channelIdListEle);
        }