AddAttribute() public méthode

Adds an attribute to the element
public AddAttribute ( string localName, string value ) : Element
localName string The name of the attribute
value string The value of the attribute
Résultat Element
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Results generated by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                Element dateDiv = new Element("div");
                dateDiv.AddStyleClass("testTime");
                dateDiv.AppendText("in " + (timeTaken + 1) + " ms ");
                dateDiv.AppendText(DateTime.Now.ToString());
                footer.AppendChild(dateDiv);

                body.AppendChild(footer);
            }
        }
 public void BeforeParsing(XDocument document)
 {
     var rootElement = new Element(document.Root);
     var existingValue = rootElement.GetAttributeValue(FakeExtensionAttrName);
     var newValue = this.m_Text;
     if (existingValue != null) {
         newValue = existingValue + ", " + newValue;
     }
     rootElement.AddAttribute(FakeExtensionAttrName, newValue);
 }
        private Element CreateBreadcrumbElement(Resource documentResource, Resource indexPageResource)
        {
            XDocument document;

            using (var inputStream = this.Source.CreateReader(indexPageResource))
            {
                document = XDocument.Load(inputStream);
            }

            var breadcrumbWording = this.GetBreadcrumbWording(new Element(document.Root), indexPageResource);
            var a = new Element("a");
            a.AddAttribute("href", documentResource.GetRelativePath(indexPageResource));
            a.AppendText(breadcrumbWording);
            return a;
        }
        private void AddFooterToDocument(Element rootElement, Resource resource, long timeTaken)
        {
            Element body = rootElement.GetFirstChildElement("body");

            if (body != null)
            {

                Element footer = new Element("div");
                footer.AddStyleClass("footer");
                footer.AppendText("Powered by ");

                Element link = new Element("a");
                link.AddAttribute("href", CONCORDION_WEBSITE_URL);
                footer.AppendChild(link);

                Element img = new Element("img");
                img.AddAttribute("src", resource.GetRelativePath(TARGET_LOGO_RESOURCE));
                img.AddAttribute("alt", "Concordion");
                img.AddAttribute("border", "0");
                link.AppendChild(img);

                body.AppendChild(footer);
            }
        }