예제 #1
0
        private static void initialize_judgeNest()
        {
            //----------------------------------------------------------------------
            // 親要素になる事の出来ない要素のリストを作成します。
            //----------------------------------------------------------------------
            judgeNest_denyList.Add("meta");
            judgeNest_denyList.Add("link");
            judgeNest_denyList.Add("br");
            judgeNest_denyList.Add("hr");
            judgeNest_denyList.Add("img");
            judgeNest_denyList.Add("col");
            judgeNest_denyList.Add("embed");
            judgeNest_denyList.Add("param");
            judgeNest_denyList.Add("area");
            judgeNest_denyList.Add("keygen");
            judgeNest_denyList.Add("source");
            judgeNest_denyList.Add("base");

            //----------------------------------------------------------------------
            // 子要素として持つ事が出来ない要素のリストを作成します。
            //----------------------------------------------------------------------
            // block element
            System.Collections.Generic.List <string> blockElements = new System.Collections.Generic.List <string>(new string[] {
                "p", "div", "h1", "h2", "h3", "h4", "h5", "h6",
                "dl", "ol", "ul", "table", "address", "blockquote", "center",
                "pre", "xmp", "listing", "plaintext"
            });
            judgeNest_denyTable.Add("p", blockElements);
            judgeNest_denyTable.Add("h1", blockElements);
            judgeNest_denyTable.Add("h2", blockElements);
            judgeNest_denyTable.Add("h3", blockElements);
            judgeNest_denyTable.Add("h4", blockElements);
            judgeNest_denyTable.Add("h5", blockElements);
            judgeNest_denyTable.Add("h6", blockElements);
            judgeNest_denyTable.Add("address", blockElements);

            judgeNest_denyTable.Add("li", new Gen::List <string>(new string[] { "li" }));

            // dictionary element
            Gen::List <string> list = new Gen::List <string> {
                "dt", "dd"
            };

            list.AddRange(blockElements);
            judgeNest_denyTable.Add("dt", list);
            judgeNest_denyTable.Add("dd", list);

            // table element
            list = new System.Collections.Generic.List <string>(new string[] { "thead", "tbody", "tfoot" });
            judgeNest_denyTable.Add("thead", list);
            judgeNest_denyTable.Add("tbody", list);
            judgeNest_denyTable.Add("tfoot", list);
            list = new System.Collections.Generic.List <string>(new string[] { "tr", "thead", "tbody", "tfoot" });
            judgeNest_denyTable.Add("tr", list);
            judgeNest_denyTable.Add("caption", list);
            list = new System.Collections.Generic.List <string>(new string[] { "td", "th", "tr", "thead", "tbody", "tfoot" });
            judgeNest_denyTable.Add("td", list);
            judgeNest_denyTable.Add("th", list);

            // ruby element
            list = new System.Collections.Generic.List <string>(new string[] { "rb", "rt", "rp" });
            judgeNest_denyTable.Add("rb", list);
            judgeNest_denyTable.Add("rt", list);
            judgeNest_denyTable.Add("rp", list);
        }