Aalto StAX Parsing: Empty Element

Overview

This article demonstrates how to to verify whether an element is empty or not using Aalto StAX parser.

Create employee.xml as shown below.

Keep the address element empty (see line 4 below).

Create TestVerifyEmptyElement class as shown below.

For the ‘address’ element (see line 21 below), use
XMLStreamReader2.isEmptyElement()
method to verify whether the element is empty (see line 23 below).

The output of the program demonstrating the verification of empty element is shown below.

Download Source Code for this Program



Leave a Comment