Element.removeChild will remove only the first child with the given name. You can use Element.removeContent(int index) to remove child element by index
if (ques.getName().equalsIgnoreCase("options")) {
ques.removeContent(2);
}
or Element.removeContent(Content content) to remove specific element.
if (ques.getName().equalsIgnoreCase("options")) {
List<Element> options = ques.getChildren("option");
if(options.size()>2) {
Element optionToRemove = options.get(2);
ques.removeContent(optionToRemove);
}
}
You said you want to remove the second option, but in your example third one is removed. I'm slightly confused, so change index if necessary.