Aalto provides a feature to peek into the next XML element from the current XML element. This is achieved by using
Note that according JSR-173 specification,
method returns the next element but does not take it off the stream.
This sample program demonstrates how to peek into the next XML element.
Create employee.xml as shown below.
Create TestPeek as shown below.
to get the start element (see line 27-39 below). Print the contents of start element (see line 28 below).
Once the start element is obtained then use
to peek into the next element which is the character text(see line 31 below). Print the contents of peek element (see line 35 below).
The output of the program demonstrating peek functionality using Aalto is shown below.
Download Source Code for this Program