Overriding Document Encoding For Elements - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
Element
Inner HTML
Outer HTML
The setOuterHTML method replaces an entire element with the provided text. Changes are reflected in
the document's HTML source code buffer immediately, but they may not be realized in the markup or
layout objects until the document is reparsed.
The effect of the setInnerHTML method depends on the kind of element being replaced:
Element
Unary tag
Binary tag
Custom tags
Comment
Text

Overriding document encoding for elements

In GoLive 6 and higher, these functions accept an optional encoding argument that is the name of an
encoding character set. When this argument is provided, the encoding it specifies overrides either the
encoding for the document (defined in the META element) or the default encoding of the document. This
feature makes it possible to extract elements that may have been encoded in a different encoding than
the other parts of a document.
A typical scenario is a user creating a document in ISO-2022-JP. If the user comments out one paragraph of
text and then changes the document encoding to X-SJIS, the change does not affect comments, leaving
the commented out paragraph in its initial encoding. Using these markup object functions, an extension
can scan all comments in a document and attempt to convert them to the same encoding the rest of the
document uses.
If you specify an unknown or unsupported encoding, GoLive generates an "Unsupported encoding"
runtime error.
Use the app or file object's openMarkup method opens a document without displaying it in a
document window. (See
GoLive provides no automatic reparsing behavior. It does not call the parseBox method, and reparses
only when you explicitly call the reparse method.
The openMarkup method returns a document object, giving you access to the markup objects for the
content. Because it does not open a window, there are no layout objects. You can display alternative user
feedback, such as
Adobe GoLive CS2 SDK
Unary
<img src="Images/ducky.jpg">
img src="Images/ducky.jpg"
<img src="Images/ducky.jpg">
setInnerHTML Behavior
You cannot use this method to set the content or attribute values.
Replaces everything between the start tag and the end tag with one or more text
elements. To delete an element, pass a replacement string containing a single space.
Replaces the tag's contents while preserving its delimiters (as defined by the
tag; see
Defining A Custom
<jsxelement>
Replaces the content of the comment while preserving the comment start (
end (
) tags.
-->
Replaces the entire text with one or more new text elements. The replacement string
must not be empty, but can contain a single space.
Open a document without displaying
Progress
bars.
Editing Documents Programmatically
Binary
Binary (no optional end tag)
<H1>Hello</H1>
<LI>first
Hello
first
<H1>Hello</H1>
<LI>first
Element).
it.) When no document window is open,
107
) and
<!--

Advertisement

Table of Contents
loading

Table of Contents