#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    1
    Rep Power
    0

    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
    at all...
    I'm posting some code as example,

    eg.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE employee SYSTEM "F:\path-to-file\employee.dtd">
    <employee category="A">
    <name>N.N</name>
    <address>something</address>
    <phone>something</phone>
    </employee>

    -----
    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.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Germany
    Posts
    8
    Rep Power
    0
    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 ...

IMN logo majestic logo threadwatch logo seochat tools logo