#include <htmlparser.h>

Public Member Functions

 KHTMLParser (KHTMLView *w, DOM::DocumentImpl *i)
 KHTMLParser (DOM::DocumentFragmentImpl *frag, DOM::DocumentImpl *doc)
DOM::HTMLScriptElementImpl * currentScriptElement () const
DOM::HTMLDocumentImpl * doc () const
DOM::DocumentImpldocPtr () const
bool noSpaces () const
void parseDoctypeToken (DoctypeToken *_t)
void parseToken (Token *_t)
void reset ()
bool selectMode () const
bool skipMode () const

Protected Member Functions

DOM::NodeImpl * getElement (Token *)
bool insertNode (DOM::NodeImpl *n, bool flat=false)
void processCloseTag (Token *)
void setCurrent (DOM::NodeImpl *newNode)

Protected Attributes


Detailed Description

The parser for html.

It receives a stream of tokens from the HTMLTokenizer, and builds up the Document structure form it.

Definition at line 70 of file htmlparser.h.

Constructor & Destructor Documentation

KHTMLParser::KHTMLParser ( KHTMLView _parent,
DOM::DocumentImpl i 

The parser parses tokenized input into the document, building up the document tree. If the document is wellformed, parsing it is straightforward. Unfortunately, people can't write wellformed HTML documents, so the parser has to be tolerant about errors.

We have to take care of the following error conditions:

  1. The element being added is explicitly forbidden inside some outer tag. In this case we should close all tags up to the one, which forbids the element, and add it afterwards.
  2. We are not allowed to add the element directly. It could be, that the person writing the document forgot some tag inbetween (or that the tag inbetween is optional...) This could be the case with the following tags: HTML HEAD BODY TBODY TR TD LI (did I forget any?)
  3. We wan't to add a block element inside to an inline element. Close all inline elements up to the next higher block element.
  4. If this doesn't help close elements, until we are allowed to add the element or ignore the tag.

Definition at line 153 of file htmlparser.cpp.

Member Function Documentation

void KHTMLParser::parseDoctypeToken ( DoctypeToken *  _t)

parses a doctype token delivered by the tokenizer

Definition at line 333 of file htmlparser.cpp.

void KHTMLParser::parseToken ( Token _t)

parses one token delivered by the tokenizer

Definition at line 231 of file htmlparser.cpp.

void KHTMLParser::reset ( )

resets the parser

Definition at line 205 of file htmlparser.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jul 13 2020 22:46:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.