File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Genarating XML help please............ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Genarating XML help please............" Watch "Genarating XML help please............" New topic
Author

Genarating XML help please............

santosh vashist
Greenhorn

Joined: May 14, 2001
Posts: 25
Hi All,
I want to genarate an XML file after reading an DTD file. I want to know how can i read an DTD file in my java programme, can any body help me please.
thanks,
santosh
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Generating a document instance based on a DTD ( or Schema specification ) is not quite easy. Since what people normally do is the quite opposite ie., apply an existing schema/DTD to an XML document, you will be disappointed to know there is no standard tool support to "cook" XML documents based on a DTD.
Think about it. You will have to consider all possible combinations of document elements and attributes supported by DTD. The relation between a DTD( or a Schema ) and a valid XML document is really one to many. When the DTD is made flexible enough to accomodate different possiblities ( mixed content, optional elements, set of elements appearing in any order etc. ), you could generate many if not infinite number of documents that are all valid.
Before you jump in, you should consider these issues. How will you handle such an "accommodative" DTD ? Since no tool support is available, you will have to parse the DTD yourself and build your generator class. What happens when the DTD changes over a period of time? How often can that happen? Will you rewrite your generator class to implement the changes and deploy it all over the client base?
If you must do this, consider XML databinding frameworks like JAXB.
Good luck,


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
Don't get me started about those stupid light bulbs.
 
subject: Genarating XML help please............
 
Similar Threads
load xml on startup
finding namespaces and dtds
I need to Java code to validate xml file against dtd
how to validate xml by using external dtd
XML Validation using the java API