User Guide
String manipulation functions 289
6 Dreamweaver calls the directive() function for each HTML comment, ASP script, JSP
script, or PHP script. The
directive() function accepts two arguments, a string that contains
the directive and the document offset, which is the number of bytes in the document before the
end of the closing tag. The function returns a Boolean value that indicates whether scanning
should continue.
7 Dreamweaver calls the text() function for each span of text in the document (that is,
everything that is not a tag or a directive). Text spans include text that is not visible to the user,
such as the text inside a
<title> or <option> tag. The text() function accepts two arguments,
a string that contains the text and the document offset, which is the number of bytes in the
document before the closing of the closing tag. The
text() function returns a Boolean value
that indicates whether scanning should continue.
Arguments
HTMLstr
, parserCallbackObj
• The HTMLstr argument is a string that contains code.
• The parserCallbackObj argument is a JavaScript object that has one or more of the following
methods:
openTagBegin(), openTagEnd(), closeTagBegin(), closeTagEnd(),
directive(), attribute(), and text(). For best performance, parserCallbackObj should
be a shared library that is defined using the C-Level Extensibility interface. Performance is also
improved if
parserCallbackObj defines only the callback functions that it needs.
Returns
A Boolean value: true if the operation completed successfully; false otherwise.
Example
The following sequence of steps provide an example of how to use the
dreamweaver.scanSourceString() function:
1 Create an implementation for one or more of the seven callback functions.
2 Write a script that calls the dreamweaver.scanSourceString() function.
3 The dreamweaver.scanSourceString() function passes a string that contains HTML and
pointers to the callback functions that you wrote. For example, the string of HTML is "<font
size=2>hello</font>"
.
4 Dreamweaver analyzes the string and determines that the string contains a font tag.
Dreamweaver calls the callback functions in the following sequence:
■ The openTagBegin() function
■ The attribute() function (for the size attribute)
■ The openTagEnd() function
■ The text() function (for the "hello" string)
■ The closeTagBegin() and closeTagEnd() functions
000_DW_API_Print.book Page 289 Wednesday, August 20, 2003 9:14 AM