CSharpTest.Net
Add Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Html Namespace > XmlLightAttributes Class : Add Method

name
value

Glossary Item Box

Adds a new attribute to the collection

Syntax

Visual Basic (Declaration) 
Public Sub Add( _
   ByVal name As String, _
   ByVal value As String _
) 
C# 
public void Add( 
   string name,
   string value
)

Parameters

name
value

Example

Library/Library.Test/TestHtmlParser.cs

C#Copy Code
HtmlLightDocument doc = new HtmlLightDocument();
XmlLightElement body = new XmlLightElement(new XmlLightElement(doc, "html"), "body");
body.IsEmpty = false;
body.Attributes.Add("id", "bdy");
Assert.AreEqual("<html> <body id=\"bdy\"> </body> </html>", Normalize(doc.InnerXml));
VB.NETCopy Code
Dim doc As New HtmlLightDocument()
Dim body As New XmlLightElement(New XmlLightElement(doc, "html"), "body")
body.IsEmpty = False
body.Attributes.Add("id", "bdy")
Assert.AreEqual("<html> <body id=""bdy""> </body> </html>", Normalize(doc.InnerXml))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys