nsIDocumentEncoder Interface Reference

import "nsIDocumentEncoder.idl";

Inheritance diagram for nsIDocumentEncoder:

Inheritance graph
[legend]
Collaboration diagram for nsIDocumentEncoder:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void init (in nsIDOMDocument aDocument, in AString aMimeType, in unsigned long aFlags)
 Initialize with a pointer to the document and the mime type.
void setSelection (in nsISelection aSelection)
 If the selection is set to a non-null value, then the selection is used for encoding, otherwise the entire document is encoded.
void setRange (in nsIDOMRange aRange)
 If the range is set to a non-null value, then the range is used for encoding, otherwise the entire document or selection is encoded.
void setNode (in nsIDOMNode aNode)
 If the node is set to a non-null value, then the node is used for encoding, otherwise the entire document or range or selection is encoded.
void setContainerNode (in nsIDOMNode aContainer)
 If the container is set to a non-null value, then its child nodes are used for encoding, otherwise the entire document or range or selection or node is encoded.
void setCharset (in ACString aCharset)
 Documents typically have an intrinsic character set, but if no intrinsic value is found, the platform character set is used.
void setWrapColumn (in unsigned long aWrapColumn)
 Set a wrap column.
void encodeToStream (in nsIOutputStream aStream)
 Encode the document and send the result to the nsIOutputStream.
AString encodeToString ()
 Encode the document into a string.
AString encodeToStringWithContext (out AString aContextString, out AString aInfoString)
 Encode the document into a string.
void setNodeFixup (in nsIDocumentEncoderNodeFixup aFixup)
 Set the fixup object associated with node persistence.

Public Attributes

const unsigned long OutputSelectionOnly = (1 << 0)
 Output only the selection (as opposed to the whole document).
const unsigned long OutputFormatted = (1 << 1)
 Plaintext output: Convert html to plaintext that looks like the html.
const unsigned long OutputRaw = (1 << 2)
 Don't do prettyprinting of HTML.
const unsigned long OutputBodyOnly = (1 << 3)
 Do not print html head tags.
const unsigned long OutputPreformatted = (1 << 4)
 Wrap even if we're not doing formatted output (e.g.
const unsigned long OutputWrap = (1 << 5)
 Output as though the content is preformatted (e.g.
const unsigned long OutputFormatFlowed = (1 << 6)
 Output for format flowed (RFC 2646).
const unsigned long OutputAbsoluteLinks = (1 << 7)
 Convert links, image src, and script src to absolute URLs when possible.
const unsigned long OutputEncodeW3CEntities = (1 << 8)
 Attempt to encode entities standardized at W3C (HTML, MathML, etc).
const unsigned long OutputCRLineBreak = (1 << 9)
 LineBreak processing: if this flag is set than CR line breaks will be written.
const unsigned long OutputLFLineBreak = (1 << 10)
 LineBreak processing: if this flag is set than LF line breaks will be written.
const unsigned long OutputNoScriptContent = (1 << 11)
 Output the content of noscript elements (only for serializing to plaintext).
const unsigned long OutputNoFramesContent = (1 << 12)
 Output the content of noframes elements (only for serializing to plaintext).
const unsigned long OutputNoFormattingInPre = (1 << 13)
 Don't allow any formatting nodes (e.g.
const unsigned long OutputEncodeBasicEntities = (1 << 14)
 Encode entities when outputting to a string.
const unsigned long OutputEncodeLatin1Entities = (1 << 15)
 Encode entities when outputting to a string.
const unsigned long OutputEncodeHTMLEntities = (1 << 16)
 Encode entities when outputting to a string.
const unsigned long OutputPersistNBSP = (1 << 17)
 Normally   is replaced with a space character when encoding data as plain text, set this flag if that's not desired.
readonly attribute AString mimeType
 The mime type preferred by the encoder.


Member Function Documentation

void nsIDocumentEncoder::init ( in nsIDOMDocument  aDocument,
in AString  aMimeType,
in unsigned long  aFlags 
)

Parameters:
aDocument Document to encode.
aMimeType MimeType to use. May also be set by SetMimeType.
aFlags Flags to use while encoding. May also be set by SetFlags.

void nsIDocumentEncoder::setSelection ( in nsISelection  aSelection  ) 

Parameters:
aSelection The selection to encode.

void nsIDocumentEncoder::setRange ( in nsIDOMRange  aRange  ) 

Parameters:
aRange The range to encode.

void nsIDocumentEncoder::setNode ( in nsIDOMNode  aNode  ) 

Parameters:
aNode The node to encode.

void nsIDocumentEncoder::setContainerNode ( in nsIDOMNode  aContainer  ) 

Parameters:
aContainer The node which child nodes will be encoded.

void nsIDocumentEncoder::setCharset ( in ACString  aCharset  ) 

This function overrides both the intrinisc and platform charset.

Parameters:
aCharset Overrides the both the intrinsic or platform character set when encoding the document.
Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER

void nsIDocumentEncoder::setWrapColumn ( in unsigned long  aWrapColumn  ) 

This may have no effect in some types of encoders.

Parameters:
aWrapColumn Column to which to wrap.

void nsIDocumentEncoder::encodeToStream ( in nsIOutputStream  aStream  ) 

Possible result codes are the stream errors which might have been encountered.

Parameters:
aStream Stream into which to encode.

AString nsIDocumentEncoder::encodeToString (  ) 

Returns:
The document encoded into a string.

AString nsIDocumentEncoder::encodeToStringWithContext ( out AString  aContextString,
out AString  aInfoString 
)

Stores the extra context information into the two arguments.

Parameters:
[OUT] aContextString The string where the parent heirarchy information will be stored.
[OUT] aInfoString The string where extra context info will be stored.
Returns:
The document encoded as a string.

void nsIDocumentEncoder::setNodeFixup ( in nsIDocumentEncoderNodeFixup  aFixup  ) 

Parameters:
aFixup The fixup object.


Member Data Documentation

Implies wrap (except inside

), since html wraps.
 HTML output: always do prettyprinting, ignoring existing formatting.
 (Probably not well tested for HTML output.)

Don't do any wrapping that's not in the existing HTML source. This option overrides OutputFormatted if both are set.

Note:
This option does not affect entity conversion.

for text fields) XXXbz this doesn't seem to be used by all serializers... document? How does this interact with OutputFormatted/OutputRaw/OutputWrap/OutputFormatFlowed?

maybe it's wrapped in a MOZ_PRE or MOZ_PRE_WRAP style tag) XXXbz this doesn't seem to be used by all serializers... document? How does this interact with OutputFormatted/OutputRaw/OutputPreformatted/OutputFormatFlowed?

This is used when converting to text for mail sending. This differs just slightly but in an important way from normal formatted, and that is that lines are space stuffed. This can't (correctly) be done later. XXXbz this doesn't seem to be used by all serializers... document? How does this interact with OutputFormatted/OutputRaw/OutputPreformatted/OutputWrap?

This is a catch-all flag for documents with mixed contents. Beware of interoperability issues. See below for other flags which might likely do what you want.

If neither this nor OutputLFLineBreak is set, then we will use platform line breaks. The combination of the two flags will cause CRLF line breaks to be written.

If neither this nor OutputCRLineBreak is set, then we will use platform line breaks. The combination of the two flags will cause CRLF line breaks to be written.


, ) inside a

.
 This is used primarily by mail.

E.g. If set, we'll output   if clear, we'll output 0xa0. The basic set is just   & < > " for interoperability with older products that don't support and friends.

The Latin1 entity set additionally includes 8bit accented letters between 128 and 255.

The HTML entity set additionally includes accented letters, greek letters, and other special markup symbols as defined in HTML4.

This piece of api was added because the copy encoder may need to switch mime types on you if you ask it to copy html that really represents plaintext content. Call this AFTER Init() and SetSelection() have both been called.


The documentation for this interface was generated from the following file:

Generated Mozilla by doxygen 1.5.6