Referecing a DTD within an XML file

S

Stu

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.
 
C

C. M. Sperberg-McQueen

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top