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:
a
b
c will becomea
b
c
Version:3.4Example
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
DomParser
public function DomParser(settings:Object, schema:Schema)
Constructs a new DomParser instance.
Parameters
Param | Detail |
---|---|
settings:Object | Name/value collection of settings. comment, cdata, text, start and end are callbacks. |
schema:Schema | HTML 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
Param | Detail |
---|---|
callback:function | Callback 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
Param | Detail |
---|---|
callback:function | Callback 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
Param | Detail |
---|---|
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
Was this article helpful? Yes - No
Well, that's awkward . Would you mind opening an issue or helping us out?
Thanks for the feedback!
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.