Overview
This sample program demonstrates how to access the XML document version and encoding information.
Create employee.xml as shown below.
Note the xml version number and encoding information (see line 1 below)
Create TestVersionAndEncoding class as shown below.
For any element, in this case ’employee’ (see line 22 below), get the version and encoding information using
XMLStreamReader2.getVersion()
and
XMLStreamReader2.getEncoding()
(see lines 23-26 below)
The output of the program demonstrating accessing version and encoding information is shown below.