Visit Mozilla.org

nsIScriptableUnescapeHTML

From MDC

The nsIScriptableUnescapeHTML interface is a utility interface that unescapes HTML strings.

Contents

nsIScriptableUnescapeHTML is defined in toolkit/components/feeds/public/nsIScriptableUnescapeHTML.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.8.1).

Inherits from: nsISupports

Implemented by @mozilla.org/feed-unescapehtml;1 as a service:

var gUnescapeHTML = Components.classes["@mozilla.org/feed-unescapehtml;1"]
                              .getService(Components.interfaces.nsIScriptableUnescapeHTML);

[edit] Method overview

AString unescape(in AString src);
nsIDOMDocumentFragment parseFragment(in AString fragment, in PRBool isXML, in nsIURI baseURI, in nsIDOMElement element);

[edit] Methods

[edit] unescape()

Converts all entities in a string into Unicode characters.

 AString unescape(
   in AString src
 );
[edit] Parameters
src
Pointer to the HTML string to unescape.
[edit] Return value

The unescaped version of the string.

[edit] Exceptions thrown
NS_ERROR_FAILURE
Unable to unescape the string.

[edit] parseFragment()

Appends a specified string to an existing DOM element. This is a feed-specific version of nsContentUtils::CreateContextualFragment.

 nsIDOMDocumentFragment parseFragment(
   in AString fragment,
   in PRBool isXML,
   in nsIURI baseURI,
   in nsIDOMElement element
 );
[edit] Parameters
fragment
Pointer to the string to append to the element.
isXML
Set this to true if the fragment is an XML string; otherwise set it to false.
baseURI
Pointer to the base URI against which to resolve any URIs included in the fragment. This parameter is ignored if isXML is false.
element
Pointer to the nsIDOMElement to which to append the fragment.
[edit] Return value

An nsIDOMDocumentFragment of the element with the new text appended.

[edit] Exceptions thrown
NS_ERROR_FAILURE
Unable to append the text to the element.

[edit] See also

nsIDOMDocumentFragment, nsIURI, nsIDOMElement