This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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).
 
 
subject: Genarating XML help please............
 
Similar Threads
XML Validation using the java API
how to validate xml by using external dtd
finding namespaces and dtds
load xml on startup
I need to Java code to validate xml file against dtd