A lot (all?) of young children's testimony in criminal matters these days is played to the court on pre-recorded video.
They don't subject the young children to the courtroom.
The cross examination of the child's testimony is done prior to trial also, and that video is played to the court.
This is Qld's ruling ... but I think most/all states might be the same.
**************
The examination-in-chief of a child witness is conducted by police officers, usually at the police station. The conversation is recorded as a video so that the child can be seen, and the evidence heard clearly. This is called a Section 93A statement. This recorded statement is then played in court as the evidence in chief, rather than the prosecution eliciting that evidence on the day of trial.
The evidence-in-chief of a child witness is much more relaxed, so as to limit the trauma suffered by the child. The Section 93A statement recording will likely include discussions that are not relevant to the criminal proceedings but are to get the child comfortable talking to the interviewer. This is not the same for adult witnesses, and such questioning would otherwise be objected to for lack of relevance.
Cross-examination is also done prior to the trial and is usually conducted by closed-circuit television. This child is hidden away from the courtroom in a separate room. The Judge, prosecution, defence lawyers and the accused sit in the courtroom, with the child appearing on the court’s television. The camera is set up so that the child witness cannot see the accused.
During any of the video recordings, the child witness can take as many breaks as he or she requires. This is again to minimise any discomfort felt by the child.
Child Witnesses in Criminal Matters (Qld) - Go To Court