July 11th, 2001, 10:13 AM
newbie at XML, please help!
I have to port data in a xml file and putting them into a DB
(I am using Windows + Apache + PHP + MySQL), and all that
work fine, but I want to validate de XML document with a DTD
and here's the problem, because I have as a result no validation
I'm posting some code as example,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE employee SYSTEM "F:\path-to-file\employee.dtd">
Then the employee.dtd,
<!ELEMENT employee (name, address, phone) >
<!ATTLIST employee category ( A| B| C) >
<!ELEMENT name (#PCDATA) >
<!ELEMENT address (#PCDATA) >
<!ELEMENT phone (#PCDATA) >
Perhaps there is something wrong at the way I am working with, because if I write <employee category="J"> no error is reported.
thanxs in advance.
Last edited by angel; July 11th, 2001 at 12:34 PM.
July 16th, 2001, 03:57 AM
Maybe you use a non-validating parser.
Your Code is correct.
So try the xml-spy, you can download it at
www.xmlspy.com. It's a very good xml-editor, which validates your code, generates DTD's ...