Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to create a form from XML-DTD

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am writing a software and i want to generate my user interface form based on the elements in a DTD because i want the interface form to be generic. how do i go about this. what tools can i use to extract the number and type of elements in a dtd and how best can i use this information to construct my user interface. Are there any good books or web sites that give examples on how to achieve this.
My MSc degree is riding on this so i would really appreciate any suggestions. Thankyou.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think a DTD gives you the kind of information you need to generate a form - for example, for a repeating element, how many input fields should you generate.
How about a "model" XML document corresponding to a fully populated form? You could fill it with the largest possible entries so you could determine the size of the various input fields.
There is a thing called XForms that the w3c is playing around with that you might look into.
This is a very interesting area so let us know how your project goes.
Bill
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mr. Brogden already said, you need to employ XML, not DTD. XML is a language which is capable to express information, DTD is a language to express grammar, not semantics! DTD is written using EBNF - very formal language designed to express grammar of computer languages. If your assignment were to create some new language, then, perhaps, you could use DTD, although I am not sure even in this case. In XML world DTDs are used to check if XML documents are formally correct, nothing more.
For inspiration, you may want to check "Java pro", April 2001, Vol 5, N.4 "XML and Java on the Menu" by Dan Wahlin. It describes an example how dynamic menus can be created. Data are kept in XML, then they are converted to HTML using DOM parser (Xerces). To run transformation, JSP technology is used.
Even more interesting example is described in "XML journal", Volume 2, Issue 3. "Converting your client/server applications to the Internet" by Victor Rasputnis and Anatole Tartakovski. User interface is described very detailed in XML format:
<NAME>gender</NAME> <TABORDER>10</TABORDER> <X>33px</X><Y>1px</Y><WIDTH>144px</WIDTH><HEIGHT>19px</HEIGHT>...
Then the authors use generic XSLT stylesheet to generate... another XSLT stylesheets, which will convert XML to HTML. Another XSLT stylesheet is used to generate Java code - maybe that is an idea you are looking for.

[This message has been edited by Mapraputa Is (edited June 30, 2001).]
 
dan nwankwo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou for the suggestions so far, i find them enlightening. Please keep them coming, i need all i can get!
Daniel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!