nsIFeedTextConstruct 编辑

toolkit/components/feeds/public/nsIFeedTextConstruct.idlScriptable This interface represents RSS or Atom feed text fields that may contain plain text, HTML, or XHTML. Some extension elements also include "type" parameters, and this interface could be used to represent those as well. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 1.8.1 (Firefox 2 / Thunderbird 2 / SeaMonkey 1.1)

Implemented by: @mozilla.org/feed-textconstruct;1, but users usually don't need to create instances of this directly. Various other feed-related interfaces, such as nsIFeed, nsIFeedEntry, and nsIFeedContainer have attributes that return objects implementing nsIFeedTextConstruct.

Method overview

nsIDOMDocumentFragment createDocumentFragment(in nsIDOMElement element);
AString plainText();

Attributes

AttributeTypeDescription
basensIURIIf the text construct contains HTML or XHTML, relative references in the content should be resolved against this base URI.
langAStringThe language of the text (such as "en-US" for U.S. English).
textAStringThe actual text content. This string may contain markup if the type is either "html" or "xhtml".
typeAStringThe type of content described; one of "text", "html", or "xhtml".

Methods

createDocumentFragment()

Creates a new document fragment on a given DOM element, containing the text and (if the text construct contains HTML or XHTML) its markup.

nsIDOMDocumentFragment createDocumentFragment(
  in nsIDOMElement element
);
Parameters
element
The element in which to create the new document fragment.
Return value

An nsIDocumentFragment containing the text and markup.

plainText()

Returns the text as plain text with all markup stripped and all entities decoded.

AString plainText();
Parameters

None.

Return value

The plain text version of the text construct's contents. If the type attribute is "text", this method returns the value of the text attribute unchanged.

Remarks

If the document type is either "html" or "xhtml", a "<" character represents markup. To display that character, an escape such as "&lt;" must be used. If the type is "text", the "<" character represents itself.

See also

Interwiki link

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:59 次

字数:5305

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文