HRFTag() Professional
Class function
HRFTag()
This class is the root class of the HTML Reflection Framework (HRF). All methods and instance variables of the HrfTag() class are available in all HTML..() classes.
Instantiation
:new( [<oParent>] , ;
[<cHTMLTag>] , ;
[<cHTMLAttributes>], ;
[<cHTMLContent>] , ;
[<lHasEndTag>] ) --> oHRFTag
<oParent> is the HRF object serving as the parent. <cHTMLTag> is a string containing the name of the HTML tag for which a HRF object is created. If specified, it must be given without the angled brackets. <cHTMAttributes> is a string containing additional attributes for the HTML tag. The string must be formatted HTML compliant. <cHTMLContent> is a string containing the content of the HTML tag, i.e. the text between the opening and closing HTML tag. <lHasEndTag> is a logical value indicationg whether or not the closing HTML tag "</TAG>" is included when the method :toHTML() generates HTML code.
Class methods
:createObjFromTag( [<oParent>] , ;
[<cHTMLTag>] , ;
[<cHTMLAttributes>], ;
[<cHTMLContent>] , ;
[<lHasEndTag>] ) --> oHTML
This method creates an object of the class reflecting a particular HTML tag. The parameters are the same as for :new().
Instance variables
:cargo | any user-defined data
This instance variable is available for user-defined purposes and can be assigned values of any data type.
Methods
:clone( <oParent> ) --> oClone
Clones an HRF object and assigns it to a parent object.
:destroy() --> self
Remove the object from the parent/child hierarchy.
Parent/child manipulation
:childFromTag( <cHTMLTag>, [<lRecursive>] ) --> oChild | NIL
Accepts a HTML tag as string and retrieves a child object matching this tag in the child-list. Nested child-lists are searched unless <lRecursive> is set to .F. (false).
:childList() --> aChildList
Returns a one-dimesional array holding references to child objects.
:delChild( <nOrdinal>|<oChild> ) --> oChild
Removes an object from the child-list array. Either the numeric position in the list or the object to be removed must be specified.
:getChild( <nOrdinal> ) --> oChild
Returns the object stored in the child-list array at the numeric position <nOrdinal>.
:insChild( <oChild>, [<nInsPos>|<oSibling>] ) --> nOrdinal
Adds the object <oChild> to the end of the child-list array or inserts it into the child-list at a given position. The position can be specified by passing a numeric ordinal<nInsPos>, or by passing an object <oSibling> already referenced in the child-list.
:isChild( <oChild> ) --> lIsChild
Returns .T. (true) if the passed object <oChild> is referenced in the child-list array.
:nextSibling() --> oSibling | NIL
Returns the next sibling of Self. It is the object referenced in the child-list of Self's parent, which is located in the next array element where Self is stored.
:previousSibling() --> oSibling | NIL
Returns the previous sibling of Self. It is the object referenced in the child-list of Self's parent, which is located in the previous array element where Self is stored.
:replaceChild( <oNewChild>, <nOrdinal>|<oChild> ) --> oOldChild | NIL
Replaces an object referenced in the child-list array with a new object <oNewChild>. The position in the child-list can be specified as numeric ordinal <nOrdinal> or by passing the object <oChild> to be replaced.
:setParent( [<oNewParent>] ) --> oOldParent
Retrieves or optionally assigns the parent object. If a new parent <oNewParent> is passed, Self is removed from the child-list of the current parent and transferred to the child-list of the new parent.
HTML code manipulation
:getAttribute( <cAttribute> ) --> cValue
Retrieves the value of an attribute of a HTML tag. If the attribute is not set or has no value, a null string ("") is returned.
:getContent() --> cHtmlCode
Returns a HTML formatted character string representing the contents of the objects referenced in the child-list array.
:getFlag( <cAttribute> ) --> lExists
Returns .T. (true) if an attribute having no value exists in a HTML tag.
:removeAttribute( <cAttribute> ) --> lSuccess
Returns .T. (true) if the specified attribute is removed from a HTML tag.
:setAttribute( <cAttribute>, <cValue>, <ConvMode> ) --> lSuccess
Returns .T. (true) if the value <cValue> is assigned to the HTML attribute <cAttribute>.
<Value> will be converted according parameter <ConvMode>. Possible values are defined in hrf.ch:
#define constant | Description |
---|---|
CONVERT_SYSTEM *) | Assume input string encoded according system settings. |
CONVERT_OEM | Assume input string OEM encoded. |
CONVERT_ANSI | Assume input string ANSI encoded. |
CONVERT_NOT | Do not convert. |
|
:setContent( <cHtmlCode> ) --> lSuccess
Accepts a HTML formatted character string and builds from it a new child-list array. The new objects in the array reflect the HTML tags contained in <cHtmlCode>. Objects referenced in the previous child-list array are discarded.
:setFlag( <cAttribute> ) --> lSuccess
Returns .T. (true) if the attribute <cAttribute> having no value is set for a HTML tag.
:toHTML( [<nIndent>], [<cLineBreak>] ) --> cHtmlCode
Returns a character string containing the HTML code reflected by the object and its child objects. The HTML code is formatted according to the passed parameters. <nIndent> is a numeric value specifying the number of spaces to be used as indentation for each nested level of child-list arrays (defaults to 1 space per level), and <cLineBreak> defines the character(s) to be used as line end markers (defaults to Chr(13)+Chr(10)).
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.