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
Summary
Actions Summary Table
Actions | Description |
---|---|
Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |
Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |
Generate() | The SetValue action returns the value of the attribute. |
GetHashCode() | This action gets the hash code for an object. |
GetName() | The GetName action returns the name of the attribute. |
GetValue() | The GetValue action returns the value of the attribute. |
SetName(text newName) | The SetName action sets the name of the attribute. |
SetValue(text newValue) | The SetValue action returns the value of the attribute. |
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.
Example Code
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Example Code
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
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.
Example Code
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
Return
text: The value of the attribute (e.g., http://www.google.com).
GetHashCode()
This action gets the hash code for an object.
Example Code
Object o
integer hash = o:GetHashCode()
Return
integer: The integer hash code of the object.
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.
Example Code
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
text result = attribute:GetName()
output result
Return
text: The name of the attribute (e.g., href).
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.
Example Code
use Libraries.Web.Page.Attribute
//by default, this would output an empty text value
Attribute attribute
text result = attribute:GetValue()
output result
Return
text: The value of the attribute (e.g., http://www.google.com).
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.
Example Code
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
Parameters
- text newName: The name of the attribute (e.g., href).
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.
Example Code
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