• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic