private bool TagBeginDefinitionListCategory(HtmlTag tag, bool bTagEnd) { if (gDefinitionList == null || tag.TagCategory != HtmlTagCategoryEnum.DefinitionList) return false; switch (tag.TagType) { case HtmlTagTypeEnum.DT: case HtmlTagTypeEnum.DD: //gDefinitionList.AppendChild(gCurrentNode); AddElement(gDefinitionList, gCurrentNode); if (!bTagEnd) gCurrentTreeNode = gCurrentNode; return true; } return false; }
private bool TagBeginTableCategory(HtmlTag tag, bool bTagEnd) { if (gTable == null || tag.TagCategory != HtmlTagCategoryEnum.Table) return false; switch (tag.TagType) { case HtmlTagTypeEnum.THead: case HtmlTagTypeEnum.TBody: case HtmlTagTypeEnum.TFoot: //gTable.Table.AppendChild(gCurrentNode); AddElement(gTable.Table, gCurrentNode); if (!bTagEnd) { gTable.Body = gCurrentNode; gCurrentTreeNode = gCurrentNode; } else gTable.Body = null; return true; case HtmlTagTypeEnum.ColGroup: //gTable.Table.AppendChild(gCurrentNode); AddElement(gTable.Table, gCurrentNode); if (!bTagEnd) { gTable.ColGroup = gCurrentNode; gCurrentTreeNode = gCurrentNode; } else gTable.ColGroup = null; return true; case HtmlTagTypeEnum.Col: gCurrentTreeNode = gTable.Table; if (gTable.ColGroup != null) gCurrentTreeNode = gTable.ColGroup; //gCurrentTreeNode.AppendChild(gCurrentNode); AddElement(gCurrentTreeNode, gCurrentNode); if (!bTagEnd) { gTable.Col = gCurrentNode; gCurrentTreeNode = gCurrentNode; } else gTable.Col = null; return true; case HtmlTagTypeEnum.TR: if (gTable.Body == null) { //gTable.Body = gXmlDocument.CreateElement("tbody"); //gTable.Table.AppendChild(gTable.Body); gTable.Body = CreateElement("tbody"); AddElement(gTable.Table, gTable.Body); } //gTable.Body.AppendChild(gCurrentNode); AddElement(gTable.Body, gCurrentNode); if (!bTagEnd) { gTable.Row = gCurrentNode; gCurrentTreeNode = gCurrentNode; } else gTable.Row = null; return true; case HtmlTagTypeEnum.TH: case HtmlTagTypeEnum.TD: if (gTable.Row == null) { if (gTable.Body == null) { //gtable.body = gxmldocument.createelement("tbody"); //gtable.table.appendchild(gtable.body); gTable.Body = CreateElement("tbody"); AddElement(gTable.Table, gTable.Body); } //gTable.Row = gXmlDocument.CreateElement("tr"); //gTable.Body.AppendChild(gTable.Row); gTable.Row = CreateElement("tr"); AddElement(gTable.Body, gTable.Row); } //gTable.Row.AppendChild(gCurrentNode); AddElement(gTable.Row, gCurrentNode); if (!bTagEnd) { gTable.Data = gCurrentNode; gCurrentTreeNode = gCurrentNode; } else gTable.Data = null; return true; } return false; }