.withMarkupRenderMode(MarkupRenderMode.XML);
for (Node c : Nodes.childrenOf(message)) {
Nodes.render(c, rc);
}
rc.getOut().noMoreTokens();
HtmlLexer lexer = new HtmlLexer(
CharProducer.Factory.fromString(
xhtml.toString(),
Nodes.getFilePositionFor(message.getFirstChild())));
lexer.setTreatedAsXml(true);
// 1 - saw <ihtml:ph
// 2 - saw <ihtml:ph >
// 3 - saw <ihtml:ph > </ihtml:ph
// 4 - saw <ihtml:ph > </ihtml:ph > or <ihtml:ph />
// 5 - saw <ihtml:eph
// 6 - saw <ihtml:eph >
// 7 - saw <ihtml:eph > </ihtml:eph
int state = 0;
// Filter out everything from the end of the <ihtml:ph> exclusive to the
// end of the <ihtml:eph> inclusive.
try {
while (lexer.hasNext()) {
Token<HtmlTokenType> tt = lexer.next();
boolean emit = state < 4;
switch (tt.type) {
case TAGBEGIN:
if (state == 0 && "<ihtml:ph".equals(tt.text)) {
state = 1;