Description

Returns new collection based on the search.


Return Type

A wodHtmlEntities object.  Collection of entities that match your search criteria.


Syntax

object.Search (Type, Pattern, [CaseSensitive])



The Search Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodHtmlEntities.
Type Required. A SearchTypes enumeration, as described in settings. Type of search performed.
Pattern Required. A String value. May contain wildcards.
CaseSensitive Optional. A Boolean value. When set to False, search is case insensitive.

Settings

The settings for Type are:

Constant Value Description
 ByText 0 When Text property matches..
 ByRaw 1 When Raw property matches.
 ByAttributeName 2 When entity attribute name matches.
 ByAttributeValue 3 When entity attribute value matches.
 ByStartAfter 4 When entity position starts after.
 ByEndBefore 5 When entity position ends before.
 ByHasChildren 6 When entity has child entities.
 ByNoText 128 When Text property does not match.
 ByNoRaw 129 When Raw property does not match.
 ByNoAttributeName 130 When entity attribute name does not match.
 ByNoAttributeValue 131 When entity attribute value does not match.
 ByStartBefore 132 When entity position starts before.
 ByEndAfter 133 When entity position ends after.
 ByHasNoChildren 134 When entity does not have child entities.

Remarks

Search method will return new collection of entities that match your search. Using this method, you can get only entities you're interested in, such as pictures, tables, frames etc.

Using SearchTypes constants, you will define the type of search - attributes, size, position in document etc.

For example, to get only entities that have attribute SRC you could use this code:

Dim ImageParts As wodHtmlEntities
Set ImageParts = tempCollection.Search(ByAttributeName, "SRC", False)

( <IMG SRC="image.jpg"> would be one such entity).

You can combine more than one search method in a row to get more specific search. For example, to get only JPG images you can do this:

Set ImageParts = tempCollection.Search(ByAttributeName, "SRC", False).Search(ByAttributeValue, "*.jpg", False)

or even more accurate search

Set ImageParts = tempCollection.Filter("IMG").Search(ByAttributeName, "SRC", False).Search(ByAttributeValue, "*.jpg", False)

which will first filter all entities for <IMG...> tags only, then search ones that have "SRC=..." attribute, and then only return ones that have "*.jpg".

Each Search method will return new IwodHtmlEntities object - collection that contains subset of parent collection.