HtmlTextWriter.cs 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. //
  2. // Permission is hereby granted, free of charge, to any person obtaining
  3. // a copy of this software and associated documentation files (the
  4. // "Software"), to deal in the Software without restriction, including
  5. // without limitation the rights to use, copy, modify, merge, publish,
  6. // distribute, sublicense, and/or sell copies of the Software, and to
  7. // permit persons to whom the Software is furnished to do so, subject to
  8. // the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be
  11. // included in all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  17. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  18. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  19. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. //
  21. /* System.Web.UI
  22. * Authors
  23. * Leen Toelen ([email protected])
  24. */
  25. using System;
  26. using System.IO;
  27. using System.Collections;
  28. using System.Web;
  29. using System.Web.UI;
  30. namespace System.Web.UI{
  31. public class HtmlTextWriter : System.IO.TextWriter {
  32. static HtmlTextWriter(){
  33. HtmlTextWriter._tagKeyLookupTable = new Hashtable(97,CaseInsensitiveHashCodeProvider.Default,
  34. CaseInsensitiveComparer.Default);
  35. HtmlTextWriter._tagNameLookupArray = new TagInformation[97];
  36. HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);
  37. HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);
  38. HtmlTextWriter.RegisterTag("acronym", HtmlTextWriterTag.Acronym, TagType.Inline);
  39. HtmlTextWriter.RegisterTag("address", HtmlTextWriterTag.Address, TagType.Other);
  40. HtmlTextWriter.RegisterTag("area", HtmlTextWriterTag.Area, TagType.Other);
  41. HtmlTextWriter.RegisterTag("b", HtmlTextWriterTag.B, TagType.Inline);
  42. HtmlTextWriter.RegisterTag("base", HtmlTextWriterTag.Base, TagType.NonClosing);
  43. HtmlTextWriter.RegisterTag("basefont", HtmlTextWriterTag.Basefont, TagType.NonClosing);
  44. HtmlTextWriter.RegisterTag("bdo", HtmlTextWriterTag.Bdo, TagType.Inline);
  45. HtmlTextWriter.RegisterTag("bgsound", HtmlTextWriterTag.Bgsound, TagType.NonClosing);
  46. HtmlTextWriter.RegisterTag("big", HtmlTextWriterTag.Big, TagType.Inline);
  47. HtmlTextWriter.RegisterTag("blockquote", HtmlTextWriterTag.Blockquote, TagType.Other);
  48. HtmlTextWriter.RegisterTag("body", HtmlTextWriterTag.Body, TagType.Other);
  49. HtmlTextWriter.RegisterTag("br", HtmlTextWriterTag.Br, TagType.Other);
  50. HtmlTextWriter.RegisterTag("button", HtmlTextWriterTag.Button, TagType.Inline);
  51. HtmlTextWriter.RegisterTag("caption", HtmlTextWriterTag.Caption, TagType.Other);
  52. HtmlTextWriter.RegisterTag("center", HtmlTextWriterTag.Center, TagType.Other);
  53. HtmlTextWriter.RegisterTag("cite", HtmlTextWriterTag.Cite, TagType.Inline);
  54. HtmlTextWriter.RegisterTag("code", HtmlTextWriterTag.Code, TagType.Inline);
  55. HtmlTextWriter.RegisterTag("col", HtmlTextWriterTag.Col, TagType.NonClosing);
  56. HtmlTextWriter.RegisterTag("colgroup", HtmlTextWriterTag.Colgroup, TagType.Other);
  57. HtmlTextWriter.RegisterTag("del", HtmlTextWriterTag.Del, TagType.Inline);
  58. HtmlTextWriter.RegisterTag("dd", HtmlTextWriterTag.Dd, TagType.Inline);
  59. HtmlTextWriter.RegisterTag("dfn", HtmlTextWriterTag.Dfn, TagType.Inline);
  60. HtmlTextWriter.RegisterTag("dir", HtmlTextWriterTag.Dir, TagType.Other);
  61. HtmlTextWriter.RegisterTag("div", HtmlTextWriterTag.Div, TagType.Other);
  62. HtmlTextWriter.RegisterTag("dl", HtmlTextWriterTag.Dl, TagType.Other);
  63. HtmlTextWriter.RegisterTag("dt", HtmlTextWriterTag.Dt, TagType.Inline);
  64. HtmlTextWriter.RegisterTag("em", HtmlTextWriterTag.Em, TagType.Inline);
  65. HtmlTextWriter.RegisterTag("embed", HtmlTextWriterTag.Embed, TagType.NonClosing);
  66. HtmlTextWriter.RegisterTag("fieldset", HtmlTextWriterTag.Fieldset, TagType.Other);
  67. HtmlTextWriter.RegisterTag("font", HtmlTextWriterTag.Font, TagType.Inline);
  68. HtmlTextWriter.RegisterTag("form", HtmlTextWriterTag.Form, TagType.Other);
  69. HtmlTextWriter.RegisterTag("frame", HtmlTextWriterTag.Frame, TagType.NonClosing);
  70. HtmlTextWriter.RegisterTag("frameset", HtmlTextWriterTag.Frameset, TagType.Other);
  71. HtmlTextWriter.RegisterTag("h1", HtmlTextWriterTag.H1, TagType.Other);
  72. HtmlTextWriter.RegisterTag("h2", HtmlTextWriterTag.H2, TagType.Other);
  73. HtmlTextWriter.RegisterTag("h3", HtmlTextWriterTag.H3, TagType.Other);
  74. HtmlTextWriter.RegisterTag("h4", HtmlTextWriterTag.H4, TagType.Other);
  75. HtmlTextWriter.RegisterTag("h5", HtmlTextWriterTag.H5, TagType.Other);
  76. HtmlTextWriter.RegisterTag("h6", HtmlTextWriterTag.H6, TagType.Other);
  77. HtmlTextWriter.RegisterTag("head", HtmlTextWriterTag.Head, TagType.Other);
  78. HtmlTextWriter.RegisterTag("hr", HtmlTextWriterTag.Hr, TagType.NonClosing);
  79. HtmlTextWriter.RegisterTag("html", HtmlTextWriterTag.Html, TagType.Other);
  80. HtmlTextWriter.RegisterTag("i", HtmlTextWriterTag.I, TagType.Inline);
  81. HtmlTextWriter.RegisterTag("iframe", HtmlTextWriterTag.Iframe, TagType.Other);
  82. HtmlTextWriter.RegisterTag("img", HtmlTextWriterTag.Img, TagType.NonClosing);
  83. HtmlTextWriter.RegisterTag("input", HtmlTextWriterTag.Input, TagType.NonClosing);
  84. HtmlTextWriter.RegisterTag("ins", HtmlTextWriterTag.Ins, TagType.Inline);
  85. HtmlTextWriter.RegisterTag("isindex", HtmlTextWriterTag.Isindex, TagType.NonClosing);
  86. HtmlTextWriter.RegisterTag("kbd", HtmlTextWriterTag.Kbd, TagType.Inline);
  87. HtmlTextWriter.RegisterTag("label", HtmlTextWriterTag.Label, TagType.Inline);
  88. HtmlTextWriter.RegisterTag("legend", HtmlTextWriterTag.Legend, TagType.Other);
  89. HtmlTextWriter.RegisterTag("li", HtmlTextWriterTag.Li, TagType.Inline);
  90. HtmlTextWriter.RegisterTag("link", HtmlTextWriterTag.Link, TagType.NonClosing);
  91. HtmlTextWriter.RegisterTag("map", HtmlTextWriterTag.Map, TagType.Other);
  92. HtmlTextWriter.RegisterTag("marquee", HtmlTextWriterTag.Marquee, TagType.Other);
  93. HtmlTextWriter.RegisterTag("menu", HtmlTextWriterTag.Menu, TagType.Other);
  94. HtmlTextWriter.RegisterTag("meta", HtmlTextWriterTag.Meta, TagType.NonClosing);
  95. HtmlTextWriter.RegisterTag("nobr", HtmlTextWriterTag.Nobr, TagType.Inline);
  96. HtmlTextWriter.RegisterTag("noframes", HtmlTextWriterTag.Noframes, TagType.Other);
  97. HtmlTextWriter.RegisterTag("noscript", HtmlTextWriterTag.Noscript, TagType.Other);
  98. HtmlTextWriter.RegisterTag("object", HtmlTextWriterTag.Object, TagType.Other);
  99. HtmlTextWriter.RegisterTag("ol", HtmlTextWriterTag.Ol, TagType.Other);
  100. HtmlTextWriter.RegisterTag("option", HtmlTextWriterTag.Option, TagType.Other);
  101. HtmlTextWriter.RegisterTag("p", HtmlTextWriterTag.P, TagType.Inline);
  102. HtmlTextWriter.RegisterTag("param", HtmlTextWriterTag.Param, TagType.Other);
  103. HtmlTextWriter.RegisterTag("pre", HtmlTextWriterTag.Pre, TagType.Other);
  104. HtmlTextWriter.RegisterTag("q", HtmlTextWriterTag.Q, TagType.Inline);
  105. HtmlTextWriter.RegisterTag("rt", HtmlTextWriterTag.Rt, TagType.Other);
  106. HtmlTextWriter.RegisterTag("ruby", HtmlTextWriterTag.Ruby, TagType.Other);
  107. HtmlTextWriter.RegisterTag("s", HtmlTextWriterTag.S, TagType.Inline);
  108. HtmlTextWriter.RegisterTag("samp", HtmlTextWriterTag.Samp, TagType.Inline);
  109. HtmlTextWriter.RegisterTag("script", HtmlTextWriterTag.Script, TagType.Other);
  110. HtmlTextWriter.RegisterTag("select", HtmlTextWriterTag.Select, TagType.Other);
  111. HtmlTextWriter.RegisterTag("small", HtmlTextWriterTag.Small, TagType.Other);
  112. HtmlTextWriter.RegisterTag("span", HtmlTextWriterTag.Span, TagType.Inline);
  113. HtmlTextWriter.RegisterTag("strike", HtmlTextWriterTag.Strike, TagType.Inline);
  114. HtmlTextWriter.RegisterTag("strong", HtmlTextWriterTag.Strong, TagType.Inline);
  115. HtmlTextWriter.RegisterTag("style", HtmlTextWriterTag.Style, TagType.Other);
  116. HtmlTextWriter.RegisterTag("sub", HtmlTextWriterTag.Sub, TagType.Inline);
  117. HtmlTextWriter.RegisterTag("sup", HtmlTextWriterTag.Sup, TagType.Inline);
  118. HtmlTextWriter.RegisterTag("table", HtmlTextWriterTag.Table, TagType.Other);
  119. HtmlTextWriter.RegisterTag("tbody", HtmlTextWriterTag.Tbody, TagType.Other);
  120. HtmlTextWriter.RegisterTag("td", HtmlTextWriterTag.Td, TagType.Inline);
  121. HtmlTextWriter.RegisterTag("textarea", HtmlTextWriterTag.Textarea, TagType.Inline);
  122. HtmlTextWriter.RegisterTag("tfoot", HtmlTextWriterTag.Tfoot, TagType.Other);
  123. HtmlTextWriter.RegisterTag("th", HtmlTextWriterTag.Th, TagType.Inline);
  124. HtmlTextWriter.RegisterTag("thead", HtmlTextWriterTag.Thead, TagType.Other);
  125. HtmlTextWriter.RegisterTag("title", HtmlTextWriterTag.Title, TagType.Other);
  126. HtmlTextWriter.RegisterTag("tr", HtmlTextWriterTag.Tr, TagType.Other);
  127. HtmlTextWriter.RegisterTag("tt", HtmlTextWriterTag.Tt, TagType.Inline);
  128. HtmlTextWriter.RegisterTag("u", HtmlTextWriterTag.U, TagType.Inline);
  129. HtmlTextWriter.RegisterTag("ul", HtmlTextWriterTag.Ul, TagType.Other);
  130. HtmlTextWriter.RegisterTag("var", HtmlTextWriterTag.Var, TagType.Inline);
  131. HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);
  132. HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);
  133. HtmlTextWriter._attrKeyLookupTable = new Hashtable(40,CaseInsensitiveHashCodeProvider.Default,
  134. CaseInsensitiveComparer.Default);
  135. HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];
  136. HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);
  137. HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);
  138. HtmlTextWriter.RegisterAttribute("alt", HtmlTextWriterAttribute.Alt, true);
  139. HtmlTextWriter.RegisterAttribute("background", HtmlTextWriterAttribute.Background, true);
  140. HtmlTextWriter.RegisterAttribute("bgcolor", HtmlTextWriterAttribute.Bgcolor, false);
  141. HtmlTextWriter.RegisterAttribute("border", HtmlTextWriterAttribute.Border, false);
  142. HtmlTextWriter.RegisterAttribute("bordercolor", HtmlTextWriterAttribute.Bordercolor, false);
  143. HtmlTextWriter.RegisterAttribute("cellpadding", HtmlTextWriterAttribute.Cellpadding, false);
  144. HtmlTextWriter.RegisterAttribute("cellspacing", HtmlTextWriterAttribute.Cellspacing, false);
  145. HtmlTextWriter.RegisterAttribute("checked", HtmlTextWriterAttribute.Checked, false);
  146. HtmlTextWriter.RegisterAttribute("class", HtmlTextWriterAttribute.Class, true);
  147. HtmlTextWriter.RegisterAttribute("cols", HtmlTextWriterAttribute.Cols, false);
  148. HtmlTextWriter.RegisterAttribute("colspan", HtmlTextWriterAttribute.Colspan, false);
  149. HtmlTextWriter.RegisterAttribute("disabled", HtmlTextWriterAttribute.Disabled, false);
  150. HtmlTextWriter.RegisterAttribute("for", HtmlTextWriterAttribute.For, false);
  151. HtmlTextWriter.RegisterAttribute("height", HtmlTextWriterAttribute.Height, false);
  152. HtmlTextWriter.RegisterAttribute("href", HtmlTextWriterAttribute.Href, true);
  153. HtmlTextWriter.RegisterAttribute("id", HtmlTextWriterAttribute.Id, false);
  154. HtmlTextWriter.RegisterAttribute("maxlength", HtmlTextWriterAttribute.Maxlength, false);
  155. HtmlTextWriter.RegisterAttribute("multiple", HtmlTextWriterAttribute.Multiple, false);
  156. HtmlTextWriter.RegisterAttribute("name", HtmlTextWriterAttribute.Name, false);
  157. HtmlTextWriter.RegisterAttribute("nowrap", HtmlTextWriterAttribute.Nowrap, false);
  158. HtmlTextWriter.RegisterAttribute("onchange", HtmlTextWriterAttribute.Onchange, true);
  159. HtmlTextWriter.RegisterAttribute("onclick", HtmlTextWriterAttribute.Onclick, true);
  160. HtmlTextWriter.RegisterAttribute("readonly", HtmlTextWriterAttribute.ReadOnly, false);
  161. HtmlTextWriter.RegisterAttribute("rows", HtmlTextWriterAttribute.Rows, false);
  162. HtmlTextWriter.RegisterAttribute("rowspan", HtmlTextWriterAttribute.Rowspan, false);
  163. HtmlTextWriter.RegisterAttribute("rules", HtmlTextWriterAttribute.Rules, false);
  164. HtmlTextWriter.RegisterAttribute("selected", HtmlTextWriterAttribute.Selected, false);
  165. HtmlTextWriter.RegisterAttribute("size", HtmlTextWriterAttribute.Size, false);
  166. HtmlTextWriter.RegisterAttribute("src", HtmlTextWriterAttribute.Src, true);
  167. HtmlTextWriter.RegisterAttribute("style", HtmlTextWriterAttribute.Style, false);
  168. HtmlTextWriter.RegisterAttribute("tabindex", HtmlTextWriterAttribute.Tabindex, false);
  169. HtmlTextWriter.RegisterAttribute("target", HtmlTextWriterAttribute.Target, false);
  170. HtmlTextWriter.RegisterAttribute("title", HtmlTextWriterAttribute.Title, true);
  171. HtmlTextWriter.RegisterAttribute("type", HtmlTextWriterAttribute.Type, false);
  172. HtmlTextWriter.RegisterAttribute("valign", HtmlTextWriterAttribute.Valign, false);
  173. HtmlTextWriter.RegisterAttribute("value", HtmlTextWriterAttribute.Value, true);
  174. HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);
  175. HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);
  176. HtmlTextWriter._styleKeyLookupTable = new Hashtable(14,CaseInsensitiveHashCodeProvider.Default,
  177. CaseInsensitiveComparer.Default);
  178. HtmlTextWriter._styleNameLookupArray = new String[14];
  179. HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);
  180. HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);
  181. HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);
  182. HtmlTextWriter.RegisterStyle("border-color", HtmlTextWriterStyle.BorderColor);
  183. HtmlTextWriter.RegisterStyle("border-style", HtmlTextWriterStyle.BorderStyle);
  184. HtmlTextWriter.RegisterStyle("border-width", HtmlTextWriterStyle.BorderWidth);
  185. HtmlTextWriter.RegisterStyle("color", HtmlTextWriterStyle.Color);
  186. HtmlTextWriter.RegisterStyle("font-family", HtmlTextWriterStyle.FontFamily);
  187. HtmlTextWriter.RegisterStyle("font-size", HtmlTextWriterStyle.FontSize);
  188. HtmlTextWriter.RegisterStyle("font-style", HtmlTextWriterStyle.FontStyle);
  189. HtmlTextWriter.RegisterStyle("font-weight", HtmlTextWriterStyle.FontWeight);
  190. HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);
  191. HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);
  192. HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);
  193. }
  194. public HtmlTextWriter(TextWriter writer):this(writer, " "){}
  195. public HtmlTextWriter(TextWriter writer, string tabString) : base() {
  196. this.writer = writer;
  197. this.tabString = tabString;
  198. indentLevel = 0;
  199. tabsPending = false;
  200. _httpWriter = writer as HttpWriter;
  201. _isDescendant = GetType() == typeof(HtmlTextWriter) == false;
  202. _attrList = new RenderAttribute[20];
  203. _attrCount = 0;
  204. _styleList = new RenderStyle[20];
  205. _styleCount = 0;
  206. _endTags = new TagStackEntry[16];
  207. _endTagCount = 0;
  208. _inlineCount = 0;
  209. }
  210. public virtual void AddAttribute(HtmlTextWriterAttribute key, string value){
  211. if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
  212. AttributeInformation attrInfo = HtmlTextWriter._attrNameLookupArray[(int) key];
  213. AddAttribute(attrInfo.name, value, key, attrInfo.encode);
  214. }
  215. }
  216. public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode){
  217. if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
  218. AddAttribute(HtmlTextWriter._attrNameLookupArray[(int) key].name, value, key, fEncode);
  219. }
  220. }
  221. public virtual void AddAttribute(string name, string value){
  222. HtmlTextWriterAttribute attr = GetAttributeKey(name);
  223. value = EncodeAttributeValue(GetAttributeKey(name), value);
  224. AddAttribute(name, value, attr);
  225. }
  226. public virtual void AddAttribute(string name, string value, bool fEndode){
  227. value = EncodeAttributeValue(value, fEndode);
  228. AddAttribute(name, value, GetAttributeKey(name));
  229. }
  230. protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key){
  231. AddAttribute(name, value, key, false);
  232. }
  233. private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode){
  234. if (_attrCount >= (int) _attrList.Length) {
  235. RenderAttribute[] rAttrArr = new RenderAttribute[_attrList.Length * 2];
  236. System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);
  237. _attrList = rAttrArr;
  238. }
  239. RenderAttribute rAttr;
  240. rAttr.name = name;
  241. rAttr.value = value;
  242. rAttr.key = key;
  243. rAttr.encode = encode;
  244. _attrList [_attrCount++] = rAttr;
  245. }
  246. public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value){
  247. AddStyleAttribute(GetStyleName(key), value, key);
  248. }
  249. public virtual void AddStyleAttribute(string name, string value){
  250. AddStyleAttribute(name, value, GetStyleKey(name));
  251. }
  252. protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){
  253. if (_styleCount >= (int) _styleList.Length) {
  254. RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2];
  255. System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);
  256. _styleList = rAttrArr;
  257. }
  258. RenderStyle rAttr;
  259. rAttr.name = name;
  260. rAttr.value = value;
  261. rAttr.key = key;
  262. _styleList [_styleCount++] = rAttr;
  263. }
  264. public override void Close(){
  265. writer.Close();
  266. }
  267. protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value){
  268. bool valid = true;
  269. if (0 <= (int) attrKey && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
  270. valid = HtmlTextWriter._attrNameLookupArray[(int) attrKey].encode;
  271. return EncodeAttributeValue(value, valid);
  272. }
  273. protected string EncodeAttributeValue(string value, bool fEncode){
  274. if (value == null)
  275. return null;
  276. if (!(fEncode))
  277. return value;
  278. return System.Web.HttpUtility.HtmlAttributeEncode(value);
  279. }
  280. protected string EncodeUrl(string url){
  281. if (url.IndexOf(SpaceChar) < 0)
  282. return url;
  283. System.Text.StringBuilder sb = new System.Text.StringBuilder();
  284. for(int i=0; i <= url.Length; i++){
  285. char temp = url[i];
  286. if (temp != 32)
  287. sb.Append(temp);
  288. else
  289. sb.Append("%20");
  290. }
  291. return sb.ToString();
  292. }
  293. protected virtual void FilterAttributes(){
  294. int count = 0;
  295. for(int i=0; i < _styleCount; i++){
  296. RenderStyle rStyle = _styleList[i];
  297. if (OnStyleAttributeRender(rStyle.name, rStyle.value, rStyle.key)) {
  298. count++;
  299. }
  300. }
  301. _styleCount = count;
  302. count = 0;
  303. for(int i=0; i <= _attrCount; i++){
  304. RenderAttribute rAttr = _attrList[i];
  305. if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {
  306. count++;
  307. }
  308. }
  309. _attrCount = count;
  310. }
  311. public override void Flush(){
  312. writer.Flush();
  313. }
  314. protected HtmlTextWriterAttribute GetAttributeKey(string attrName){
  315. if (attrName != null && attrName.Length > 0) {
  316. object attr = HtmlTextWriter._attrKeyLookupTable[attrName];
  317. if (attr != null)
  318. return (HtmlTextWriterAttribute) attr;
  319. }
  320. return (HtmlTextWriterAttribute) (-1);
  321. }
  322. protected string GetAttributeName(HtmlTextWriterAttribute attrKey){
  323. if ((int) attrKey >= 0 && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
  324. return HtmlTextWriter._attrNameLookupArray[(int) attrKey].name;
  325. return System.String.Empty;
  326. }
  327. protected HtmlTextWriterStyle GetStyleKey(string styleName){
  328. if (styleName != null && styleName.Length > 0) {
  329. object style = HtmlTextWriter._styleKeyLookupTable[styleName];
  330. if (style != null)
  331. return (HtmlTextWriterStyle) style;
  332. }
  333. return (HtmlTextWriterStyle) (-1);
  334. }
  335. protected string GetStyleName(HtmlTextWriterStyle styleKey){
  336. if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)
  337. return HtmlTextWriter._styleNameLookupArray[(int) styleKey];
  338. return System.String.Empty;
  339. }
  340. protected virtual HtmlTextWriterTag GetTagKey(string tagName){
  341. if (tagName != null && tagName.Length > 0) {
  342. object tag = HtmlTextWriter._tagKeyLookupTable[tagName];
  343. if (tag != null)
  344. return (HtmlTextWriterTag) tag;
  345. }
  346. return 0;
  347. }
  348. protected virtual string GetTagName(HtmlTextWriterTag tagKey){
  349. if ((int) tagKey >= 0 && (int) tagKey < HtmlTextWriter._tagNameLookupArray.Length)
  350. return HtmlTextWriter._tagNameLookupArray[(int) tagKey].name;
  351. return System.String.Empty;
  352. }
  353. protected bool IsAttributeDefined(HtmlTextWriterAttribute key){
  354. for (int i=0; i < _attrCount; i++) {
  355. if (_attrList[i].key == key)
  356. return true;
  357. }
  358. return false;
  359. }
  360. protected bool IsAttributeDefined(HtmlTextWriterAttribute key, out string value){
  361. value = null;
  362. for (int i=0; i < _attrCount; i++) {
  363. if (_attrList[i].key == key) {
  364. value = _attrList[i].value;
  365. return true;
  366. }
  367. }
  368. return false;
  369. }
  370. protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key){
  371. for (int i= 0; i < _styleCount; i++) {
  372. if (_styleList[i].key == key)
  373. return true;
  374. }
  375. return false;
  376. }
  377. protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, out string value){
  378. value = null;
  379. for( int i=0; i < _styleCount; i++) {
  380. if (_styleList[i].key == key) {
  381. value = _styleList[i].value;
  382. return true;
  383. }
  384. }
  385. return false;
  386. }
  387. protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key){
  388. return true;
  389. }
  390. protected virtual bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key){
  391. return true;
  392. }
  393. protected virtual bool OnTagRender(string name, HtmlTextWriterTag key){
  394. return true;
  395. }
  396. protected virtual void OutputTabs(){
  397. if (tabsPending) {
  398. for(int i=0; i < indentLevel; i++) {
  399. writer.Write(tabString);
  400. }
  401. tabsPending = false;
  402. }
  403. }
  404. protected string PopEndTag(){
  405. if (_endTagCount <= 0)
  406. throw new InvalidOperationException("A PopEndTag was called without a corresponding PushEndTag");
  407. _endTagCount--;
  408. TagKey = _endTags[_endTagCount].tagKey;
  409. return _endTags[_endTagCount].endTagText;
  410. }
  411. protected void PushEndTag(string endTag){
  412. if (_endTagCount >= (int) _endTags.Length) {
  413. TagStackEntry[] temp = new TagStackEntry[(int) _endTags.Length * 2];
  414. System.Array.Copy(_endTags, temp, (int) _endTags.Length);
  415. _endTags = temp;
  416. }
  417. _endTags[_endTagCount].tagKey = _tagKey;
  418. _endTags[_endTagCount].endTagText = endTag;
  419. _endTagCount++;
  420. }
  421. protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key){
  422. HtmlTextWriter.RegisterAttribute(name, key, false);
  423. }
  424. private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool fEncode){
  425. name = name.ToLower();
  426. HtmlTextWriter._attrKeyLookupTable.Add(name, key);
  427. if ((int) key < (int) HtmlTextWriter._attrNameLookupArray.Length)
  428. HtmlTextWriter._attrNameLookupArray[(int) key] = new AttributeInformation(name, fEncode);
  429. }
  430. protected static void RegisterStyle(string name, HtmlTextWriterStyle key){
  431. name = name.ToLower();
  432. HtmlTextWriter._styleKeyLookupTable.Add(name, key);
  433. if ((int) key < (int) HtmlTextWriter._styleNameLookupArray.Length)
  434. HtmlTextWriter._styleNameLookupArray[(int) key] = name;
  435. }
  436. protected static void RegisterTag(string name, HtmlTextWriterTag key){
  437. HtmlTextWriter.RegisterTag(name, key, TagType.Other);
  438. }
  439. private static void RegisterTag(string name, HtmlTextWriterTag key, TagType type){
  440. name = name.ToLower();
  441. HtmlTextWriter._tagKeyLookupTable.Add(name, key);
  442. string fullTag = null;
  443. if ((int) type != 1 && (int) key != 0) {
  444. fullTag = EndTagLeftChars + name + TagRightChar;
  445. }
  446. if ((int) key < HtmlTextWriter._tagNameLookupArray.Length)
  447. HtmlTextWriter._tagNameLookupArray[(int) key] = new TagInformation(name, type, fullTag);
  448. }
  449. protected virtual string RenderAfterContent(){
  450. return null;
  451. }
  452. protected virtual string RenderAfterTag(){
  453. return null;
  454. }
  455. protected virtual string RenderBeforeContent(){
  456. return null;
  457. }
  458. protected virtual string RenderBeforeTag(){
  459. return null;
  460. }
  461. public virtual void RenderBeginTag(HtmlTextWriterTag tagKey){
  462. TagKey = tagKey;
  463. bool tagRendered = true;
  464. bool tagRender = true;
  465. if (_isDescendant) {
  466. tagRender = OnTagRender(_tagName, _tagKey);
  467. FilterAttributes();
  468. string beforeTag = RenderBeforeTag();
  469. if (beforeTag != null) {
  470. if (tabsPending)
  471. OutputTabs();
  472. writer.Write(beforeTag);
  473. }
  474. }
  475. TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];
  476. if (currentTag.closingTag == null && currentTag.tagType == TagType.Other) {
  477. currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
  478. }
  479. if (tagRender) {
  480. tagRendered = false;
  481. if (tabsPending)
  482. OutputTabs();
  483. writer.Write(TagLeftChar);
  484. writer.Write(_tagName);
  485. RenderAttribute rAttr;
  486. string rAttrValue = null;
  487. for (int i=0; i < _attrCount; i++) {
  488. rAttr = _attrList[i];
  489. if (rAttr.key == HtmlTextWriterAttribute.Style)
  490. rAttrValue = rAttr.value;
  491. else {
  492. writer.Write(SpaceChar);
  493. writer.Write(rAttr.name);
  494. if (rAttr.value != null) {
  495. writer.Write(EqualsChar);
  496. writer.Write(DoubleQuoteChar);
  497. if (rAttr.encode) {
  498. if (_httpWriter == null) {
  499. System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, writer);
  500. }
  501. else {
  502. System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, (TextWriter) _httpWriter);
  503. }
  504. }
  505. else {
  506. writer.Write(rAttr.value);
  507. }
  508. writer.Write(DoubleQuoteChar);
  509. }
  510. }
  511. }
  512. if (_styleCount > 0 || rAttrValue != null) {
  513. writer.Write(SpaceChar);
  514. writer.Write("style");
  515. writer.Write(EqualsChar);
  516. writer.Write(DoubleQuoteChar);
  517. RenderStyle rStyle;
  518. for (int i=0; i < _styleCount; i++) {
  519. rStyle = _styleList[i];
  520. writer.Write(rStyle.name);
  521. writer.Write(StyleEqualsChar);
  522. writer.Write(rStyle.value);
  523. writer.Write(SemicolonChar);
  524. }
  525. if (rAttrValue != null)
  526. writer.Write(rAttrValue);
  527. writer.Write(DoubleQuoteChar);
  528. }
  529. if (currentTag.tagType == TagType.NonClosing) {
  530. writer.Write(SpaceChar);
  531. writer.Write(SlashChar);
  532. writer.Write(TagRightChar);
  533. }
  534. else
  535. writer.Write(TagRightChar);
  536. }
  537. string beforeContent = RenderBeforeContent();
  538. if (beforeContent != null) {
  539. if (tabsPending)
  540. OutputTabs();
  541. writer.Write(beforeContent);
  542. }
  543. if (tagRendered) {
  544. if (currentTag.tagType == TagType.Inline)
  545. _inlineCount++;
  546. else {
  547. WriteLine();
  548. Indent++;
  549. }
  550. if (currentTag.closingTag == null) {
  551. currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
  552. }
  553. }
  554. if (_isDescendant) {
  555. string afterContent = RenderAfterContent();
  556. if (afterContent != null) {
  557. if (currentTag.closingTag != null)
  558. currentTag.closingTag = afterContent;
  559. }
  560. string afterTag = RenderAfterTag();
  561. if (afterTag != null) {
  562. if (currentTag.closingTag != null)
  563. currentTag.closingTag = afterTag;
  564. }
  565. }
  566. PushEndTag(currentTag.closingTag);
  567. _attrCount = 0;
  568. _styleCount = 0;
  569. }
  570. public virtual void RenderBeginTag(string tagName){
  571. TagName = tagName;
  572. RenderBeginTag(_tagKey);
  573. }
  574. public virtual void RenderEndTag(){
  575. string endTagText = PopEndTag();
  576. if (endTagText != null) {
  577. if (HtmlTextWriter._tagNameLookupArray[_tagIndex].tagType == 0) {
  578. _inlineCount--;
  579. Write(endTagText);
  580. }
  581. else{
  582. WriteLine();
  583. Indent--;
  584. Write(endTagText);
  585. }
  586. }
  587. }
  588. public override void Write(bool value){
  589. if (tabsPending)
  590. OutputTabs();
  591. writer.Write(value);
  592. }
  593. public override void Write(char value){
  594. if (tabsPending)
  595. OutputTabs();
  596. writer.Write(value);
  597. }
  598. public override void Write(char[] buffer){
  599. if (tabsPending)
  600. OutputTabs();
  601. writer.Write(buffer);
  602. }
  603. public override void Write(char[] buffer, int index, int count){
  604. if (tabsPending)
  605. OutputTabs();
  606. writer.Write(buffer, index, count);
  607. }
  608. public override void Write(double value){
  609. if (tabsPending)
  610. OutputTabs();
  611. writer.Write(value);
  612. }
  613. public override void Write(int value){
  614. if (tabsPending)
  615. OutputTabs();
  616. writer.Write(value);
  617. }
  618. public override void Write(long value){
  619. if (tabsPending)
  620. OutputTabs();
  621. writer.Write(value);
  622. }
  623. public override void Write(object value){
  624. if (tabsPending)
  625. OutputTabs();
  626. writer.Write(value);
  627. }
  628. public override void Write(float value){
  629. if (tabsPending)
  630. OutputTabs();
  631. writer.Write(value);
  632. }
  633. public override void Write(string s){
  634. if (tabsPending)
  635. OutputTabs();
  636. writer.Write(s);
  637. }
  638. public override void Write(string format, object arg0){
  639. if (tabsPending)
  640. OutputTabs();
  641. writer.Write(format, arg0);
  642. }
  643. public override void Write(string format, object arg0, object arg1){
  644. if (tabsPending)
  645. OutputTabs();
  646. writer.Write(format, arg0, arg1);
  647. }
  648. public override void Write(string format, params object[] arg){
  649. if (tabsPending)
  650. OutputTabs();
  651. writer.Write(format, arg);
  652. }
  653. public virtual void WriteAttribute(string name, string value){
  654. WriteAttribute(name, value, false);
  655. }
  656. public virtual void WriteAttribute(string name, string value, bool fEncode){
  657. writer.Write(SpaceChar);
  658. writer.Write(name);
  659. if (value != null) {
  660. writer.Write(EqualsChar);
  661. writer.Write(DoubleQuoteChar);
  662. if (fEncode) {
  663. if (_httpWriter == null) {
  664. System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
  665. }
  666. else{
  667. System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
  668. }
  669. }
  670. else{
  671. writer.Write(value);
  672. }
  673. writer.Write(DoubleQuoteChar);
  674. }
  675. }
  676. public virtual void WriteBeginTag(string tagName){
  677. if (tabsPending)
  678. OutputTabs();
  679. writer.Write(TagLeftChar);
  680. writer.Write(tagName);
  681. }
  682. public virtual void WriteEndTag(string tagName){
  683. if (tabsPending)
  684. OutputTabs();
  685. writer.Write(TagLeftChar);
  686. writer.Write(SlashChar);
  687. writer.Write(tagName);
  688. writer.Write(TagRightChar);
  689. }
  690. public virtual void WriteFullBeginTag(string tagName){
  691. if (tabsPending)
  692. OutputTabs();
  693. writer.Write(TagLeftChar);
  694. writer.Write(tagName);
  695. writer.Write(TagRightChar);
  696. }
  697. public override void WriteLine(){
  698. writer.WriteLine();
  699. tabsPending = true;
  700. }
  701. public override void WriteLine(bool value){
  702. if (tabsPending)
  703. OutputTabs();
  704. writer.WriteLine(value);
  705. tabsPending = true;
  706. }
  707. public override void WriteLine(char value){
  708. if (tabsPending)
  709. OutputTabs();
  710. writer.WriteLine(value);
  711. tabsPending = true;
  712. }
  713. public override void WriteLine(char[] buffer){
  714. if (tabsPending)
  715. OutputTabs();
  716. writer.WriteLine(buffer);
  717. tabsPending = true;
  718. }
  719. public override void WriteLine(char[] buffer, int index, int count){
  720. if (tabsPending)
  721. OutputTabs();
  722. writer.WriteLine(buffer, index, count);
  723. tabsPending = true;
  724. }
  725. public override void WriteLine(double value){
  726. if (tabsPending)
  727. OutputTabs();
  728. writer.WriteLine(value);
  729. tabsPending = true;
  730. }
  731. public override void WriteLine(int value){
  732. if (tabsPending)
  733. OutputTabs();
  734. writer.WriteLine(value);
  735. tabsPending = true;
  736. }
  737. public override void WriteLine(long value){
  738. if (tabsPending)
  739. OutputTabs();
  740. writer.WriteLine(value);
  741. tabsPending = true;
  742. }
  743. public override void WriteLine(object value){
  744. if (tabsPending)
  745. OutputTabs();
  746. writer.WriteLine(value);
  747. tabsPending = true;
  748. }
  749. public override void WriteLine(float value){
  750. if (tabsPending)
  751. OutputTabs();
  752. writer.WriteLine(value);
  753. tabsPending = true;
  754. }
  755. public override void WriteLine(string s){
  756. if (tabsPending)
  757. OutputTabs();
  758. writer.WriteLine(s);
  759. tabsPending = true;
  760. }
  761. public override void WriteLine(string format, object arg0){
  762. if (tabsPending)
  763. OutputTabs();
  764. writer.WriteLine(format, arg0);
  765. tabsPending = true;
  766. }
  767. public override void WriteLine(string format, object arg0, object arg1){
  768. if (tabsPending)
  769. OutputTabs();
  770. writer.WriteLine(format, arg0, arg1);
  771. tabsPending = true;
  772. }
  773. public override void WriteLine(string format, params object[] arg){
  774. if (tabsPending)
  775. OutputTabs();
  776. writer.WriteLine(format, arg);
  777. tabsPending = true;
  778. }
  779. [CLSCompliant(false)]
  780. public override void WriteLine(uint value){
  781. if (tabsPending)
  782. OutputTabs();
  783. writer.WriteLine(value);
  784. tabsPending = true;
  785. }
  786. public void WriteLineNoTabs(string s){
  787. writer.WriteLine(s);
  788. }
  789. public virtual void WriteStyleAttribute(string name, string value){
  790. WriteStyleAttribute(name, value, false);
  791. }
  792. public virtual void WriteStyleAttribute(string name, string value, bool fEncode){
  793. writer.Write(name);
  794. writer.Write(StyleEqualsChar);
  795. if (fEncode) {
  796. if (_httpWriter == null) {
  797. System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
  798. }
  799. else{
  800. System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
  801. }
  802. }
  803. else {
  804. writer.Write(value);
  805. }
  806. writer.Write(SemicolonChar);
  807. }
  808. public override System.Text.Encoding Encoding {
  809. get{
  810. return writer.Encoding;
  811. }
  812. }
  813. public int Indent {
  814. get{
  815. return indentLevel;
  816. }
  817. set{
  818. if (value < 0)
  819. value = 0;
  820. indentLevel = value;
  821. }
  822. }
  823. public TextWriter InnerWriter {
  824. get{
  825. return writer;
  826. }
  827. set{
  828. writer = value;
  829. _httpWriter = value as HttpWriter;
  830. }
  831. }
  832. public override string NewLine {
  833. get{
  834. return writer.NewLine;
  835. }
  836. set{
  837. writer.NewLine = value;
  838. }
  839. }
  840. protected HtmlTextWriterTag TagKey {
  841. get{
  842. return _tagKey;
  843. }
  844. set{
  845. _tagIndex = (int) value;
  846. if (_tagIndex < 0 || _tagIndex >= (int) HtmlTextWriter._tagNameLookupArray.Length)
  847. throw new ArgumentOutOfRangeException("value");
  848. _tagKey = value;
  849. if (value != 0)
  850. _tagName = HtmlTextWriter._tagNameLookupArray[_tagIndex].name;
  851. }
  852. }
  853. protected string TagName {
  854. get{
  855. return _tagName;
  856. }
  857. set{
  858. _tagName = value;
  859. _tagKey = GetTagKey(_tagName);
  860. _tagIndex = (int) _tagKey;
  861. }
  862. }
  863. public const string DefaultTabString = "\t";
  864. public const char DoubleQuoteChar = '"';
  865. public const string EndTagLeftChars = "</";
  866. public const char EqualsChar = '=';
  867. public const string EqualsDoubleQuoteString = "=\"";
  868. public const string SelfClosingChars = " /";
  869. public const string SelfClosingTagEnd = " />";
  870. public const char SemicolonChar = ';';
  871. public const char SingleQuoteChar = '\'';
  872. public const char SlashChar = '/';
  873. public const char SpaceChar = ' ';
  874. public const char StyleEqualsChar = ':';
  875. public const char TagLeftChar = '<';
  876. public const char TagRightChar = '>';
  877. private int _attrCount;
  878. private int _endTagCount;
  879. private int _styleCount;
  880. private int indentLevel;
  881. private int _inlineCount;
  882. private int _tagIndex;
  883. private bool _isDescendant;
  884. private bool tabsPending;
  885. private HtmlTextWriterTag _tagKey;
  886. private TextWriter writer;
  887. private HttpWriter _httpWriter;
  888. private static Hashtable _attrKeyLookupTable;
  889. private static Hashtable _styleKeyLookupTable;
  890. private static Hashtable _tagKeyLookupTable;
  891. private string _tagName;
  892. private string tabString;
  893. private static string[] _styleNameLookupArray;
  894. private RenderAttribute[] _attrList;
  895. private static AttributeInformation[] _attrNameLookupArray;
  896. private static TagInformation[] _tagNameLookupArray;
  897. private TagStackEntry[] _endTags;
  898. private RenderStyle[] _styleList;
  899. } //HtmlTextWriter
  900. struct AttributeInformation {
  901. public bool encode;
  902. public string name;
  903. public AttributeInformation(string name, bool encode){
  904. this.encode = encode;
  905. this.name = name;
  906. }
  907. }
  908. struct RenderAttribute {
  909. public bool encode;
  910. public HtmlTextWriterAttribute key;
  911. public string name;
  912. public string value;
  913. }
  914. struct RenderStyle {
  915. public HtmlTextWriterStyle key;
  916. public string name;
  917. public string value;
  918. }
  919. struct TagInformation {
  920. public string closingTag;
  921. public string name;
  922. public TagType tagType;
  923. public TagInformation(string name, TagType tagType, string closingTag){
  924. this.name = name;
  925. this.tagType = tagType;
  926. this.closingTag = closingTag;
  927. }
  928. }
  929. struct TagStackEntry {
  930. public string endTagText;
  931. public HtmlTextWriterTag tagKey;
  932. }
  933. enum TagType {
  934. Inline,
  935. NonClosing,
  936. Other
  937. }
  938. } // namespace System.Web.UI.HtmlControls