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); }
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(); }
/// <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); }
/// <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); }
public XmlElement CreateAttributeElement(string name) { XmlElement ele = OwnerDocument.CreateElement("attribute"); ele.SetAttribute("name", name); return(ele); }
public XmlElement CreateChannelElement(string channelId) { XmlElement ele = OwnerDocument.CreateElement("channel"); ele.SetAttribute("id", channelId); return(ele); }
/// <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); }
/// <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); }
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; }
public override XmlNode Clone() { AnyXmlElement targetEle = OwnerDocument.CreateElement(this.Name) as AnyXmlElement; XmlUtilService.CopyXmlElement(this, targetEle); return(targetEle); }
/// <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); }
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); }
public HTMLTableSectionElement CreateTFoot() { var foot = TFoot; if (foot == null) { foot = OwnerDocument.CreateElement(Tags.Tfoot) as HTMLTableSectionElement; AppendChild(foot); } return(foot); }
public HTMLTableCaptionElement CreateCaption() { var caption = Caption; if (caption == null) { caption = OwnerDocument.CreateElement(Tags.Caption) as HTMLTableCaptionElement; AppendChild(caption); } return(caption); }
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); }
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); }
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); }
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); }
/// <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); }
/// <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); }
// 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); }
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); }
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)); }
public XmlElement CreateChannelListElement() { XmlElement _channelIdListEle = OwnerDocument.CreateElement("channels"); return(_channelIdListEle); }