void read(Tokeniser t, CharacterReader r) { if (r.matchConsume("--")) { t.createCommentPending(); t.transition(CommentStart); } else if (r.matchConsumeIgnoreCase("DOCTYPE")) { t.transition(Doctype); } else if (r.matchConsume("[CDATA[")) { // todo: should actually check current namepspace, and only non-html allows cdata. until // namespace // is implemented properly, keep handling as cdata // } else if (!t.currentNodeInHtmlNS() && r.matchConsume("[CDATA[")) { t.transition(CdataSection); } else { t.error(this); t.advanceTransition( BogusComment); // advance so this character gets in bogus comment data's rewind } }
void read(Tokeniser t, CharacterReader r) { String data = r.consumeTo("]]>"); t.emit(data); r.matchConsume("]]>"); t.transition(Data); }