API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IHTMLVIEWMODEL_GETELEMTEXT()

Brew Release
Brew MP 1.0.2
See Also
- IHTMLViewModel_FindElem - IHTMLViewModel_GetAttrValue
Description
This function obtains the text content of an element. Contained elements are ignored, and separate sections of text content (including that of sub-elements) are concatenated.
Params
pif
[]:
Pointer to the IHTMLViewModel interface object. nElem The location of the element in the document. This can be obtained from IHTMLVIEWMODEL_FindElem(). pchBuf Pointer to the start of a buffer to hold the result (which is a zero-terminated string) cbBuf Size of the buffer, in bytes
Interface
Prototype
  •    int32 IHTMLViewModel_GetElemText(IHTMLViewModel *pif, int32 nElem, char *pchBuf, int32 cbBuf);
    
Return
  •    HVM_BADELEMENT, if failure.  This occurs only when the nElemPos value is invalid.  
       
       Length of the resulting string, if successful. 
       
       0(zero), if an empty element, or an element that contains no text is present.  
       
       A value larger than cbBuf may be returned, but only cbBuf bytes are written to 
       the buffer in that case.  
    
Side Effect
  • None
Comments
The text that we are getting from IHTMLVIEWMODEL_GetElemText() is the text between the opening and closing tag such as in links, titles, etc. For example: Link Text Please note that IHTMLVIEWMODEL_GetElemText cannot be used to retrieve the text of the text input control. The text input control is not a container, so the end tag is forbidden. In order to retrieve it's default text IHTMLVIEWMODEL_GetAttrValue() should be used.