Referecing a DTD within an XML file

Discussion in 'XML' started by Stu, Jul 9, 2003.

  1. Stu

    Stu Guest

    I have the following syntax in my XML file

    <!DOCTYPE config SYSTEM "config.dtd">

    And also have my xml file and dtd file in the same directory, yet when I use
    the following XML validator

    http://www.stg.brown.edu/service/xmlvalid/

    to validate my document I get this error.

    I:\exec\pbh\config.xml:
    error (563): can't resolve System ID: config.dtd

    Can somebody please give me the correct syntax on how to specify a DTD within
    an XML file or is this a problem with the XML validator.

    FYI, if I encapsulate the DTD within the XML file it appears to work fine.

    Thanks in advance for all who answer this post.
    Stu, Jul 9, 2003
    #1
    1. Advertising

  2. (Stu) writes:

    > I have the following syntax in my XML file
    >
    > <!DOCTYPE config SYSTEM "config.dtd">
    >
    > And also have my xml file and dtd file in the same directory, yet when I use
    > the following XML validator
    >
    > http://www.stg.brown.edu/service/xmlvalid/
    >
    > to validate my document I get this error.
    >
    > I:\exec\pbh\config.xml:
    > error (563): can't resolve System ID: config.dtd


    You're using a Web-based validator. It does not have access to your
    local file system. It had BETTER not have access to the entire
    directory from which you uploaded the XML file you are asking it to
    validate. If it's using the normal file-upload interface, I don't
    think it knows what directory the file came from (I could be wrong
    here, it's been a few years since I read the spec on file uploading
    from HTML forms).

    So the validator is having trouble resolving the relative URL you have
    specified in the system identifier. Your LOCAL validator may be
    perfectly happy with it -- most XML parsers will say "well, I am
    reading file F in the file system, so I'll just absolutize this to
    also be a file:// URL ...", and they are right to do so. But it's
    not really fair to expect the software at Brown to hack into your
    local file system just to validate a document.

    > Can somebody please give me the correct syntax on how to specify a DTD within
    > an XML file or is this a problem with the XML validator.


    You're using the correct syntax. (Or A correct syntax.)

    The validator is also doing the Right Thing.

    The problem appears to be what the old mainframe error-code manuals
    used to call Probable Operator Error. You are expecting the wrong
    thing. If you want a web-based validator to get access to files,
    you either have to hand it the files (by uploading them with the
    forms data) or the files have to be on the Web somewhere.

    So: put the DTD on the Web somewhere, and give its full URI
    in the system identifier of the XML document. And try again.
    And then, when you have five minutes to spare, install RXP or SP
    or expat locally.

    > Thanks in advance for all who answer this post.


    I hope this helps.

    -C. M. Sperberg-McQueen
    World Wide Web Consortium
    C. M. Sperberg-McQueen, Jul 10, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    340
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,746
    Ronald Fischer
    Mar 17, 2005
  3. yw
    Replies:
    2
    Views:
    479
  4. test
    Replies:
    2
    Views:
    1,999
    Oliver Wong
    Jul 28, 2006
  5. Ultrus
    Replies:
    3
    Views:
    365
    Stefan Behnel
    Jul 9, 2007
Loading...

Share This Page