The SgmlParser class parses a data stream into a normalized sequence of start tags, end tags, and content. More...
Publicly inherits QObject, StyleSheetReceiver.
SgmlParser | ( ); | |
void | styleSheet | ( StyleSheet* styleSheet ); |
const QList<Style>& | styleStack | ( ); |
const QList<STag>& | tagStack | ( ); |
~SgmlParser | ( ); |
void | data | ( const char* bytes, int length ); |
void | dtd | ( Dtd* dtd ); |
void | endOfData | ( ); |
void | lexerDone | ( ); |
void | token | ( Token token, const char* text ); |
void | closeTags | ( int depth ); |
void | commit | ( ); |
bool | doContent | ( QString text ); |
bool | doEndTag | ( QString tag, int depth ); |
bool | doEndTagHack | ( QString tag ); |
bool | doStartTag | ( STag& tag, int depth ); |
bool | etagOptional | ( int depth ); |
bool | excluded | ( QString tag, int depth ); |
bool | fitsModel | ( QString tag, int depth ); |
bool | included | ( QString tag, int depth ); |
void | logStack | ( ); |
void | openTag | ( STag& tag ); |
void | rollback | ( ); |
bool | satisfied | ( int depth ); |
bool | tryOptional | ( int depth ); |
void | content | ( QString text ); |
void | done | ( ); |
void | dtdSelected | ( QString dtdName ); |
void | endTag | ( ); |
void | fwdData | ( const char* bytes, int length ); |
void | fwdEndOfData | ( ); |
void | startTag | ( ); |
QString | _attrName; |
QString | _attrValue; |
Dtd* | _dtd; |
QString | _dtdName; |
QString | _dtdType; |
bool | _endOfData; |
QString | _leftover; |
SgmlLexer* | _lexer; |
QList<Op> | _ops; |
QList<State> | _stack; |
STag | _startTag; |
StyleSheet* | _styleSheet; |
QList<Style> | _styleStack; |
QString | _tag; |
QList<STag> | _tagStack; |
The SgmlParser class parses a data stream into a normalized sequence of start tags, end tags, and content.
The SgmlParser converts a stream of SGML tokens into a normailzed stream of start tags, end tags, and content. The stream is normalized because for Every star tag there is a corresponding end tag. This makes the job of rendering the document much easier.This parser is capable of inserting optional end tags, optional start tags, and even empty elements where needed to insure that the document structure given in the DTD is satisfied. It will even make some pretty good guesses when parsing documents with errors, so that it can continue to parse the rest of the document.
Create a new SgmlParser. Create an SgmlLexer to do some of the dirty work.
Forward the data signals to the SgmlLexer.
This slot is activated when the DtdManager has finished processing our DTD request. Feed any queued data to the SgmlLexer.
Forward the endOfData signal to the SgmlLexer.
This slot is activated after the last token has been received. Try to close any open tags on the stack.
Process a token from the lexer. Try to parse tokens into start tags, end tags, and content. Then normalize the tag stream with doStartTag() and doEndTag().
Close off all the tags up to, but not including, the tag at the given stack depth. Just create the necessary operations, but don't apply them yet.
We've successfully fit the start/end tag into the content model. Now actually emit the start and end tags.
Emit the given content.
Try to fit the given end tag into the parse tree for the current document instance.
This is a kludge to cope with documents that have overlapping start and end tags. For example http://www.troll.no/ ;)
Try to fit the given start tag into the parse tree for the current document instance.
Returns TRUE if the end tag for the element at the given stack depth is optional.
Returns TRUE if the given element is excluded from the content model at the given stack depth.
Returns TRUE if the given tag can be directly fit into the content model of the element at the given stack depth.
Returns TRUE if the given element is included in the content model at the given stack depth.
Open a new tag and push it onto the stack. Just create the operations, but don't apply them yet.
Back out any changes made to the tag stack while trying to fit in a start or end tag.
Returns TRUE if the content model at the given stack depth is in an accepting state.
See if there is an element with an optional start tag that can be inserted into the content model for the element at the given stack depth. Returns TRUE if successful.
This signal is emitted when content is parsed.
This signal is emitted when no more tags or content will be emitted.
This signal is emitted to inform the browser that we have settled on a DTD.
This signal is emitted when an end tag is parsed.
This signal is used to forward the data signals to the SgmlLexer.
This signal is used to forward the endOfData signal to the SgmlLexer.
This signal is emitted when a start tag is parsed. The tag includes any attributes that were present.