当前位置: 首页 > 文档资料 > tinyMCE 帮助文档 >

tinymce-html-SaxParser

优质
小牛编辑
149浏览
2023-12-01

Examples

var parser = new tinymce.html.SaxParser({
    validate: true,

    comment: function(text) {
        console.log('Comment:', text);
    },

    cdata: function(text) {
        console.log('CDATA:', text);
    },

    text: function(text, raw) {
        console.log('Text:', text, 'Raw:', raw);
    },

    start: function(name, attrs, empty) {
        console.log('Start:', name, attrs, empty);
    },

    end: function(name) {
        console.log('End:', name);
    },

    pi: function(name, text) {
        console.log('PI:', name, text);
    },

    doctype: function(text) {
        console.log('DocType:', text);
    }
}, schema);

Constructors

namesummarydefined by
SaxParser()Constructs a new SaxParser instance.tinymce.html.SaxParser

Methods

namesummarydefined by
parse()Parses the specified HTML string and executes the callbacks for each item it finds.tinymce.html.SaxParser

Constructors

SaxParser

public constructor function SaxParser(settings:Object, schema:tinymce.html.Schema)

Constructs a new SaxParser instance.

Parameters
  • settings (Object) - Name/value collection of settings. comment, cdata, text, start and end are callbacks.
  • schema (tinymce.html.Schema) - HTML Schema class to use when parsing.

Methods

parse

parse(html:String)

Parses the specified HTML string and executes the callbacks for each item it finds.

Examples
SaxParser({...}).parse('<b>text</b>');
Parameters
  • html (String) - Html string to sax parse.

Can't find what you're looking for? Let us know.

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.