Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The combination of contentHandler and lexicalHandler #112

Open
eGavr opened this issue Aug 10, 2014 · 1 comment
Open

The combination of contentHandler and lexicalHandler #112

eGavr opened this issue Aug 10, 2014 · 1 comment

Comments

@eGavr
Copy link

eGavr commented Aug 10, 2014

You have written this:

"No. There is a lexicalHandler, that can handle comments, doctype, cdata sections. But this feature is not implemented yet (but it is very easy to do)."

Are you going to do this?)

I mean, it would be great if you could combine contentHandler and lexicalHandler into one Handler!

This way, everybody will be able to create the DOM tree of HTML code in manner as they want!

@danyaPostfactum
Copy link
Collaborator

You can combine both handlers, there are no limitations.

parser.contentHandler = parser.lexicalHandler = {
    /* implement both interfaces */
};

These interfaces are described by SAX project:
http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html

By the way, I was wrong about CDATA sections: HTML5 tokenizer does not produce these.
CDATA is illegal in HTML(treated as comment), but allowed in foreign content, such as SVG or MathML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants