I am using StAX parser for generating XML. Here is what I need to generate:
<?xml version = "1.0"?>
<!DOCTYPE FILE PUBLIC "-//SOMETHING//DTD bla bla bla//EN" "scheme.dtd"
[
<!ENTITY file1 SYSTEM "D:\repo\file1.pdf" NDATA application_pdf>
]
>
<FILES>
<FILE>
<METADATA></METADATA>
<CONTENT></CONTENT>
..... and so on .....
The problem is I don't know how to declare DOCTYPE and ENTITY tags. Tried to google it and didn't find any solutions. Please, help.
There is a method for this in the XMLStreamWriter class: writeDTD. Just pass the entire DOCTYPE blob into there.