Using
java to create XML with DTD
You can
use java to create dynamic XML with DTD. You can use the JSP (Java Server
Pages) technology for that purpose. With JSP you can generate any type
of document and not only HTML as many of you would have done.
_______________________________________________
_______________________________________________
The
simplest was to fill up the contents of an XML file is to create a template
XML file and then insert the java code within the text nodes for generation
of the values of the elements.
You can
also generate the elements by inserting appropriate java code in the
place of the elements. For example in a jsp file, you can have something
like,
<%@
page contentType="text/xml;charset=ISO-8859-1" %>
<?xml version="1.0" encoding="ISO-8859-1"?>
.
.
.
<some_element><% java code here %> </some_element>
.
.
In the
above code we have a portion where the data of the XML file is generated
by the java code.
You can
also generate the XML tags itself by using the java code. This is only
way of generating the XML file by using the java code.