tinymce.html.DomParser

Namespace tinymce.html
Class DomParser
This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make sure that the node tree is valid according to the specified schema. So for example: <p>a<p>b</p>c</p> will become <p>a</p><p>b</p><p>c</p>
Version:3.4

Example

Public Methods

Method Defined By
DomParser(settings:Object, schema:Schema)
Constructs a new DomParser instance.
DomParser
addAttributeFilter(callback:function):void
Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes and then...
DomParser
addNodeFilter(callback:function):void
Adds a node filter function to the parser, the parser will collect the specified nodes by name and then execute the call...
DomParser
parse(html:String, args:Object):Node
Parses the specified HTML string into a DOM like node tree and returns the result.
DomParser

Method details

DomParserconstructor

public function DomParser(settings:Object, schema:Schema)
Constructs a new DomParser instance.

Parameters

settings:Object Name/value collection of settings. comment, cdata, text, start and end are callbacks.
schema:Schema HTML Schema class to use when parsing.

addAttributeFiltermethod

public function addAttributeFilter(callback:function):void
Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes and then execute the callback ones it has finished parsing the document.

Parameters

callback:function Callback function to execute once it has collected nodes.

Example

addNodeFiltermethod

public function addNodeFilter(callback:function):void
Adds a node filter function to the parser, the parser will collect the specified nodes by name and then execute the callback ones it has finished parsing the document.

Parameters

callback:function Callback function to execute once it has collected nodes.

Example

parsemethod

public function parse(html:String, args:Object):Node
Parses the specified HTML string into a DOM like node tree and returns the result.

Parameters

html:String Html string to sax parse.
args:Object Optional args object that gets passed to all filter functions.

Returns

Node - Root node containing the tree.

Example