Aalto StAX Parsing: Document Type

Overview

This sample program demonstrates the parsing of documment type within XML using Aalto StAX parser.

Create employee.xml as shown below.

Note the doc type element with prefix name ’employee’, public id ‘-//STUDYTRAILS//DTD 4.1//EN’ and system id ’employee.dtd’ (see line 1 below).

Create TestDocType as shown below.

For the event type
XMLEvent.DTD
(see line 22 below), get doc type related information like prefixed name, public id and system id (see lines 24-26 below).

The output of the program demonstrating parsing of doc type related information is shown below.

Download Source Code for this Program



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Bitnami