out.write(' ');
/* List item contents are more varied; text, inline markup; maybe
* even sublists.
*/
SMInputCursor itemIt = it.childMixedCursor();
SMEvent evt;
while ((evt = itemIt.getNext()) != null) {
if (evt == SMEvent.START_ELEMENT) {
String tag = itemIt.getLocalName().toLowerCase();
// only care about sub-lists:
if (tag.equals("ul") || tag.equals("ol")) {
out.write('\n'); // to finish off the current line
processList(itemIt, out, (tag.charAt(0) == 'u') ? '*' : '#',
depth+1);
/* Also, let's also ignore whatever came after the sublist,
* for this item, if anything; most likely just whitespace.
* Problem otherwise is how to handle "leftovers"; can't
* add them to this item any more, would need to start
* a new item or something.
*/
return;
} else { // can also process inline markup
String str = checkInlineMarkup(itemIt, tag);
if (str != null) {
addSingleLine(out, str);
continue;
}
}
// Otherwise, let's just collect and output text:
addSingleLine(out, itemIt.collectDescendantText(true));
} else {
addSingleLine(out, itemIt.getText());
}
}
out.write('\n');
}