GetRootElement() 공개 메소드

Gets the root element of the System.Xml.Linq.XDocument that this Element is contained within
public GetRootElement ( ) : Element
리턴 Element
예제 #1
0
        private void EnsureDocumentHasTogglingScript(Element element)
        {
            Element rootElement = element.GetRootElement();

            if (!RootElementsWithScript.Contains(rootElement))
            {
                RootElementsWithScript.Add(rootElement);
                Element head = rootElement.GetFirstDescendantNamed("head");
                if (head == null)
                {
                    Console.WriteLine(rootElement.ToXml());
                }
                Check.NotNull(head, "Document <head> section is missing");
                Element script = new Element("script").AddAttribute("type", "text/javascript");
                head.PrependChild(script);
                script.AppendText(HtmlFramework.TOGGLING_SCRIPT_RESOURCE);
            }
        }