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

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
Generate()
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 a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: 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

Return

boolean: True if the hash codes are equal and false if they are not equal.

Generate()

Return

text

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

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

Parameters