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!

How to add DTD into XML file?

843834Jun 24 2005 — edited Jun 27 2005
Hello all,

I am using JAXP to create XML file by DOM. I have faced the problem when I tried to put DTD info to XML that the XML always refer to the DTD file which is not what I want to do. I just want get the DTD and XML data place together in the same XML file. Is it possible to do that or it's just the dream I can not reach? Thank you for any help in advance.
Best Regards,

The result I got now.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Employees SYSTEM "Employees.dtd">
<Employees>
<Employee name="Liviu" surname="Tudor" dob="14/02/1975" email="user@domain.com" address="Coocooland"/>
<Employee name="Janet" surname="Jackson" dob="unpolite to reveal" email="janet@rhythmnation.com" address="Really really secret ;-)"/>
</Employees>

The example of result I need in the XML file.
<?xml version="1.0" encoding="UTF-8"? >
<!DOCTYPE Employees [
<!ELEMENT Employees (Employee)*>
<!ELEMENT Employee EMPTY>
<!ATTLIST Employee
name CDATA #REQUIRED
surname CDATA #REQUIRED
dob CDATA #IMPLIED
email CDATA #IMPLIED
phone CDATA #IMPLIED
address CDATA #IMPLIED>
]>
<Employees>
<Employee name="Liviu" surname="Tudor" dob="14/02/1975" email="user@domain.com" address="Coocooland"/>
<Employee name="Janet" surname="Jackson" dob="unpolite to reveal" email="janet@rhythmnation.com" address="Really really secret ;-)"/>
</Employees>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2005
Added on Jun 24 2005
1 comment
209 views