Greg,
If you are using xerces to serialize the DOM, you can use the OutputFormat
class to add the DOCTYPE declaration,
ie:
OutputFormat format = new OutputFormat(document); // Document
document
format.setDoctype(publicId, systemId); //
String publicId,systemId
(Sets the document type public and system identifiers); // system
identifier would be the DTD
Then use the format when constructing a serializer,
XMLSerializer serial = new XMLSerializer(output, format); //
FileOutputStream output
http://xml.apache.org/xerces-j/apiDocs/org/apache/xml/serialize/OutputFormat.html
--John
Greg Hess wrote:
> Hi All,
>
> I am building an adapter on my Struts app to allow Web Service calls
> from remote parties. A remote call constructs a XML and sends the
> request via http to my Struts app. My app processes the request by
> parsing the XML data posted and returns the XML result. This is all
> working but my spec states that I use DTD and a validating parser to
> ensure that the request's and responses contain valid data elements. I
> would like to be able to build the XML data completely dynamically and
> then return that DOM to the client.
>
> My problem is that the DOM built must contain the DOCTYPE declaration
> for the server to use in parsing(validating). When I build a document
> using the DOMImplementation using a DocType and output that DOM to some
> OutputStream the DOCTYPE declaration is missing. I have read some
> reports that state the ability to build a DOM data structure with a
> DOCTYPE declaration is not yet supported by parser implementations. I am
> using latest version of Xerces/Xalan and unfortunately there archives
> are down and that mailing list is dead.
>
> Does anyone know how I can achieve this and what parser implementation
> supports the dynamic building of a DOM with a DOCTYPE.
>
> Many thanks for your help,
>
> Greg
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>