Specifications

453
Enabler
“dreamweaver.canExportTemplateDataAsXML()” on page 420
Example
if(dreamweaver.canExportTemplateDataAsXML())
{
dreamweaver.exportTemplateDataAsXML("file:///c|/dw_temps/mytemplate.txt")
}
dreamweaver.getDocumentDOM()
Availability
Dreamweaver 2
Description
Provides access to the tree of objects for the specified document. After the tree of objects returns
to the caller, the caller can edit the tree to change the contents of the document.
Arguments
sourceDoc
sourceDoc
must be "document", "parent", "parent.frames[number]",
"parent.frames['frameName']", or a URL. The sourceDoc value defaults to "document" if
you do not supply a value.
document specifies the document that has focus and contains the current selection.
parent specifies the parent frameset (if the currently selected document is in a frame).
parent.frames[number] and parent.frames[’frameName’] specify a document that is in a
particular frame within the frameset that contains the current document.
If the argument is a relative URL, it is relative to the extension file. In Dreamweaver 4,
sourceDoc defaults to document if omitted.
Note: If the argument is "document", the caller must be applyBehavior(), deleteBehavior(),
objectTag(), or any function in a command or Property inspector file in order to perform edits to the document.
Returns
The JavaScript document object at the root of the tree.
Examples
The following example uses dreamweaver.getDocumentDOM() to access the current document:
var theDOM = dreamweaver.getDocumentDOM("document");
In the following example, the current document DOM identifies a selection and pastes it at the
end of another document:
var currentDOM = dreamweaver.getDocumentDOM(’document’);
currentDOM.setSelection(100,200);
currentDOM.clipCopy();
var otherDOM = dreamweaver.openDocument(dreamweaver.¬
getSiteRoot() + "html/foo.htm");
otherDOM.endOfDocument();
otherDOM.clipPaste();
Note: openDocument() is used because dom methods normally operate only on open documents. Running a
function on a document that isn’t open causes a Dreamweaver error.
dom methods that can operate only on the
active document or on closed documents indicate this fact in their descriptions.