beautypg.com

Translation functions, Dom.runtranslator() – Adobe Dreamweaver API Reference CS5 User Manual

Page 304

background image

299

DREAMWEAVER API REFERENCE

Document

Last updated 8/27/2013

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

"hello"

.

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

Translation functions

Translation functions deal either directly with translators or with translation results. These functions get information
about or run a translator, edit content in a locked region, and specify that the translated source should be used when
getting and setting selection offsets.

dom.runTranslator()

Availability
Dreamweaver 3.

Description
This function runs the specified translator on the document. This function is valid only for the active document.

Arguments
translatorName

The translatorName argument is the name of a translator as it appears in the Translation preferences.