How to add DTD into XML file?
843834Jun 24 2005 — edited Jun 27 2005Hello 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>