DOMHTMLDocument Additions Reference

(informal protocol)

Inherits from
DOMDocument : DOMNode : DOMObject : WebScriptObject : NSObject
Conforms to
Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in OS X v10.5 and later.
Declared in
DOMExtensions.h
Companion guides

Overview

Additions to the DOMHTMLDocument class to create document fragments.

Tasks

Creating Document Fragments

Instance Methods

createDocumentFragmentWithMarkupString:baseURL:

Creates a document fragment containing the given HTML markup.

- (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL
Parameters
markupString

The HTML content to parse into a DOM tree.

baseURL

The URI from which the content originated. Used for interpreting relative URLs.

Return Value

A DOMDocumentFragment derived from the original markup string.

Discussion

This is a convenience method for the createDocumentFragment method in DOMDocument. It creates a fragment that has the HTML markup parsed into child nodes of the fragment using the baseURL to resolve any relative paths for images or other resources.

Availability
  • Available in OS X v10.5 and later.
Declared In
DOMExtensions.h

createDocumentFragmentWithText:

Creates a document fragment containing the given text.

- (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text
Parameters
text

The text to convert.

Return Value

A DOMDocumentFragment object derived from the source text.

Discussion

This is a convenience method for the createDocumentFragment method in DOMDocument. This method creates a fragment that contains the supplied plain text.

Availability
  • Available in OS X v10.5 and later.
Declared In
DOMExtensions.h