Libraries.Web.Page.Attribute Documentation
The Attribute class represents a property of a particular tag in the web libraries. For example, the Hypertext Markup Language (HTML) 5 standard, we might define an attribute that represents a web link, or the location of an image or move file. Most of the time, users will not need to interact with the Attribute class, unless you need to gather information from an existing web page. Generally, most WebTag objects allow you to set attributes automatically, without needing to instantiate an Attribute directly.
Example Code
use Libraries.Web.Page.Attribute
Attribute attribute
text result = attribute:Generate()
output result
Inherits from: Libraries.Web.Page.WebGenerator, Libraries.Language.Object
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
Generate()
The SetValue action returns the value of the attribute. The name in this context matches with what is called an "Value" in the Hypertext Markup Language (HTML) 5 standard. For example, the value might indicate the location of a file or an image, or where to link to on the web.
Return
text: The value of the attribute (e.g., http://www.google.com).
Example
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
attribute:SetValue("http://www.google.com")
text result = attribute:GetValue()
output result
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetName()
The GetName action returns the name of the attribute. The name in this context matches with what is called an "Attribute" in the Hypertext Markup Language (HTML) 5 standard. For example, in HTML, the "href" tag indicates where to link to in web links.
Return
text: The name of the attribute (e.g., href).
Example
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
text result = attribute:GetName()
output result
GetValue()
The GetValue action returns the value of the attribute. The name in this context matches with what is called an "Value" in the Hypertext Markup Language (HTML) 5 standard. For example, the value might indicate the location of a file or an image, or where to link to on the web.
Return
text: The value of the attribute (e.g., http://www.google.com).
Example
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
text result = attribute:GetValue()
output result
SetName(text newName)
The SetName action sets the name of the attribute. The name in this context matches with what is called an "Attribute" in the Hypertext Markup Language (HTML) 5 standard. For example, in HTML, the "href" tag indicates where to link to in web links.
Parameters
- text newName: The name of the attribute (e.g., href).
Example
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
attribute:SetName("src")
text result = attribute:GetName()
output result
SetValue(text newValue)
The SetValue action returns the value of the attribute. The name in this context matches with what is called an "Value" in the Hypertext Markup Language (HTML) 5 standard. For example, the value might indicate the location of a file or an image, or where to link to on the web.
Parameters
- text newValue
Example
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
attribute:SetValue("http://www.google.com")
text result = attribute:GetValue()
output result