Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Generating XML Documents using DTD

843834Nov 7 2001 — edited Nov 8 2001
Dear Friends,
I have a very urgent problem to be solved... i'm jus new to XML..
i have a DTD.. and using the DTD i need to create an XML document on the fly.. so naturally it means i need to parse the DTD..
suppose for example i hav a dtd like tis...
<!--cardentryscreenresponse.dtd(c1000.dtd)-->
<!ELEMENT message (header ,body)>
<!ELEMENT header (messageid,from,to)>
<!ELEMENT messageid (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT body (cardnumber)>
<!ELEMENT cardnumber (#PCDATA)>

i need to generate an xml using tis dtd in mi java code.. like
<?xml version="1.0"?>
<!DOCTYPE message SYSTEM "c1000.dtd">
<message>
<header>
<messageid>c1000</messageid>
<from>s1000</from>
<to>s1000</to>
</header>
<body>
<cardnumber>
4444 4444 4444 4444
</cardnumber>
</body>
</message>
where the values to b filled up is from the java code.. the coding required is very generic.. so when i use a different dtd i need to generate a different xml...
how will i go abt tis ... please help me out. itz very urgent...
thankx alot in advance.
Harish
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2001
Added on Nov 7 2001
3 comments
270 views