File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I get the DOCTYPE declaration output from an org.w3c.xml.Document object?

 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

I'm not quite sure what I'm doing wrong here. In fact, I believe my attempt at solving my problem thus far, which doesn't work, is itself sort of a hack.

Anyway, I have a Document instance that I'm using a java.xml.transform.Transformer instance to write out to a file.

Everything works fairly well, except that I need the following declaration to be in the resulting XML file, and it's not there:

<!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>


I'm creating a template file that already has that reference, and parsing that file into the Document instance, then adding all the elements I need, then using the transform object to write it out. Still, while everything is perfect, that DOCTYPE reference is missing.

How can I fix this problem? Ideally, instead of using that empty template file, I'd like to create my Document instance the right way, but I'm not sure how.

Thanks in advance.
 
Paul Clapham
Sheriff
Pie
Posts: 20184
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know you asked this nearly a week ago, but the answer is this:Do that before you call its transform() method.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic