This week's book giveaway is in the Testing forum. We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line! See this thread for details.
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.
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11862
posted
0
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
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).]