0 results found

tinymce.html.DomParser

Contribute to this page
Namespacetinymce.html
ClassDomParser

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:

a

b

c

will become

a

b

c

Version:3.4

Example

Public Methods

MethodDefined 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

DomParser

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

Parameters

ParamDetail
settings:ObjectName/value collection of settings. comment, cdata, text, start and end are callbacks.
schema:SchemaHTML Schema class to use when parsing.

addAttributeFilter

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

ParamDetail
callback:functionCallback function to execute once it has collected nodes.

Example

addNodeFilter

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

ParamDetail
callback:functionCallback function to execute once it has collected nodes.

Example

parse

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

Parameters

ParamDetail
html:StringHtml string to sax parse.
args:ObjectOptional args object that gets passed to all filter functions.

Returns
Node - Root node containing the tree.

Example

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.