users@jaxb.java.net

Re: adding DTD declaration to an xml file

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 4 Jun 2008 15:31:16 +0200

Hi.

> I am working on standardized web-service supporting many version of the same
> service.
> to stay compatible with older version i need to create an xml document with
> a DTD declaration such as :
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE WMT_MS_Capabilities SYSTEM "pathToMyDTD\WMS_MS_Capabilities.dtd">
> <WMT_MS_Capabilities version="1.1.1" updateSequence="0">
>
> ------
> </WMT_MS_Capabilities>
>
> is it possible to add this property when marshalling an object?
> and if yes how?

Please try the following:

marshaller.setProperty("com.sun.xml.bind.xmlHeaders",
              "<!DOCTYPE ....>\n");

Bye.
/lexi