Description
Gets the text data that is contained in the current PBDOM_OBJECT with all surrounding whitespace characters removed and internal whitespace characters normalized to a single space.
Syntax
pbdom_object_name.GetTextNormalize()
Return value
String.
The normalized text content of the current PBDOM_OBJECT, or an empty string if there is no text content.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- This PBDOM_OBJECT object is not associated with a derived PBDOM_OBJECT class object.
EXCEPTION_MEMORY_ALLOCATION_FAILURE -- Insufficient memory was encountered while executing this method.
Usage
This method returns meaningful data only if the PBDOM_OBJECT is of a type that can contain text nodes or CDATA sections, or of a type that intrinsically contains basic text. These types are:
-
PBDOM_ELEMENT
-
PBDOM_ATTRIBUTE
-
PBDOM_TEXT
-
PBDOM_CDATA
-
PBDOM_COMMENT
The PBDOM_TEXT, PBDOM_CDATA, and PBDOM_COMMENT classes are special cases that cause the GetTextNormalize method to return the intrinsic text data contained within their instances. A PBDOM_TEXT object represents a DOM text node, therefore it does not hold any child DOM Nodes. PBDOM_CDATA object is a representation of a DOM CDATA object and does not hold any child DOM Nodes. Nor does PBDOM_COMMENT contain any child DOM Nodes.
The following table lists the return values based on the type of actual DOM Object contained within PBDOM_OBJECT:
DOM Object Type |
Return Value |
---|---|
PBDOM_ELEMENT |
The normalized text of the concatenation of the text values of all the TEXT Nodes and CDATA Sections contained within the PBDOM_ELEMENT. Suppose there is a PBDOM_ELEMENT defined as follows: <abc> Root Element Data <data>ABC Data </data> now with extra info </abc> GetTextNormalize returns Root Element Data now with extra info. Suppose there is a PBDOM_ELEMENT defined as follows: <abc> Root Element Data </abc> GetTextNormalize returns Root Element Data. Suppose there is a PBDOM_ELEMENT defined as follows: <abc> Root Element Data <![CDATA [ with some cdata text]]></abc> GetTextNormalize returns "Root Element Data with some cdata text". |
PBDOM_ATTRIBUTE |
The normalized text data contained within the PBDOM_ATTRIBUTE object. Suppose there is an element with an attribute as follows: <abc ATTRIBUTE_1=" My Attribute "> GetTextNormalize returns My Attribute. |
PBDOM_TEXT |
The normalized text data contained within the PBDOM_TEXT object itself. For example, suppose there is the following element: <abc> MY TEXT </abc> If there is a PBDOM_TEXT object to represent the text node "MY TEXT", then calling GetTextNormalize on the PBDOM_TEXT returns the string MY TEXT. |
PBDOM_CDATA |
The normalized string data that is contained within the CDATA section itself. For example, suppose there is the following CDATA: <![CDATA[ They're saying "x < y" & that "z > y" so I guess that means that z > x ]]> If there is a PBDOM_CDATA to represent the above CDATA section, then calling GetTextNormalize on it returns the string: They're saying " x < y " & that "z > y" so I guess that means that z > x Note that the initial spaces before "They're" and the trailing space after the last "x" have been removed. Additionally, the spaces between the word "guess" and "that" have been reduced to just one space. |
PBDOM_COMMENT |
The normalized string data that is contained within the COMMENT itself. For example, suppose there is the following COMMENT: <!-- Comment Here !--> Calling GetTextNormalize on the COMMENT returns the string Comment Here ! |
See also